Deploy Jenkins CI to Heroku - java

Is there a way to run Jenkins CI as an Heroku app?
It is possible to run Java Apps on heroku but I cannot find description of how to make Jenkins run on Heroku anywhere.
Very grateful for hints.

Easy enough to load Jenkins as a heroku app
1) pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!--
Just need a plain and mostly empty pom.xml for Orchard to detect that this is a Java application
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<version>1.0-SNAPSHOT</version>
<artifactId>helloworld</artifactId>
</project>
A Procfile that looks like this:
Only listen on http; disable ajp and https
web: java -jar jenkins.war --httpPort=$PORT --ajp13Port=-1 --httpsPort=-1
The jenkins.war file.
The real problem becomes that jenkins uses the local filesystem for storage and the local storage is not persistent in the Heroku environment so you have to manage your configuration regularly or using the github storage add-on.

Related

How to create simple maven java web project

I spend more than a half day to figure out how to do simple maven project. Eclipse seems weird IDE throwing all errors.
Steps I did:
1, Installed Eclipse
2, Maven home & java home and path set environment variable
3, Create a simple maven project
pom.xml has error first line
[![enter image description here][2]][2]
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
From tutorials and videos i've referred it has java resource folder with version mentioned also there when creating new maven project.
I am using eclipse photon and maven 3.5.4
Error dialog : Probel occured
'Building workspace encountered problem'
'Errors occured during build'
Error Dialog description:
Errors running builder 'Maven Project Builder' on project 'TestApp'.
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-resources-plugin:jar:2.6
pom.xml contents:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gps</groupId>
<artifactId>TestApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gps</groupId>
<artifactId>TestApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
</project>
This is the very minimum pom.xml content you need. If you have this then the something else should be the problem. You don't need more than this to build a simple basic maven project. I think closing tag </project> is missing the the code you posted
<h4>Error was thrown Because it was unable to download any artifacts or resources from repo.
Reason was i was behind the proxy i needed to configure in settings.xml <br/> Located in <br/> pref-> maven -> user settings<br/>
After i configured everything working fine<br/>
</h4>
<xmp>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>proxy.somewhere.com</host>
<port>80</port>
</proxy>
</xmp>

Maven - How to create a pom.xml for java project through command line

Currently working on a work training on Maven. I've never used it before and the training is very limited. One of the assessments is asking me to do the following using command line.
Create a new Directory in a local storage.
Place the downloaded project in this directory and create maven build file(pom.xml).**
In pom.xml file create a project element, In project element create default elements such as modelVersion,groupId,artifactId,packaging,version,name for project
Its the number 2 I can't seem to get write. I know how to create a new maven project using command line(below), however when I try to create the pom.xml for a project, it doesn't work.
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
Any help would be great thanks.
I solved a similar problem by creating an empty Maven project, then taking that default (basically a template) pom.xml and modifying it to my project's configuration.
What I did was start by creating a pom.xml wrapper that looked like this:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
</project>
Then I added the specifics of my project like this:
<modelVersion>4.0.0</modelVersion>
<groupId>com.ingeniigroup.stratux</groupId>
<artifactId>AvMet</artifactId>
<version>0.1.0</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
[...]
Once I had done that, maven handled the build just fine.
I wrote a blog entry that has some more background if you need it: http://blog.daviddemartini.com/configure-maven-pom-xml-to-build-integrated-executable-jar-fat-jar/
You can run mvn archetype:generate without parameters. Maven will ask about your project and generate the POM.

Module project is not declared as war package, but get error 'web.xml is missing and <failOnMissingWebXml> is set to true' in eclipse

Module project was declared as war package before in pom.xml, then I removed row <packaging>war</packaging>, I can get expected XX.jar successfully when I run command line mvn install, however, I'm still get error web.xml is missing and <failOnMissingWebXml> is set to true in eclipse.
I have applied 'Force update of snapshot/releases' several times but it's meaningless.
pom.xml
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xx</groupId>
<artifactId>xxx</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>xxx</artifactId>
<name>xxxx</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>xxxx</groupId>
<artifactId>xxxx</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
I found there is web service descriptor however there shouldn't be. I didn't find any way I can delete the descriptor I copy all source files to another folder, create another workspace in eclipse and import the project. All works well.
I had a similar problem - maven project that due to some refactoring went from war package to jar. Was surprisingly difficult to clear the dang marker "web.xml is missing but failOnMissingWebXml is true".
I checked thru the .classpath and .project files - the project in particular had several WST natures that I deleted. After that, I finally deleted the project from Eclipse but left the files on disk, then re-imported the existing maven project into Eclipse. This worked, I think the delete cleared all the hidden metadata.
Just had the same issue - you need to generate a web.xml file.
Right click on Deployment Descriptor in Project Explorer.
Select Generate Deployment Descriptor Stub.
It will generate WEB_INF folder in src/main/webapp and an web.xml in it.
Thanks

I can not find keycloak web resources deployed in tomcat

I deployed keycloak in tomcat with eclipse Luna based on this tutorial: https://reachmnadeem.wordpress.com/2015/01/14/deploying-keycloak-in-tomcat/#comment-245
I have it running in my machine and have no problem. Now I have to edit the login form based on my company design. But I do not have local files .css and .htmls to do it.
This is the parent project and some war configuration.
<parent>
<artifactId>keycloak-parent</artifactId>
<groupId>org.keycloak</groupId>
<version>1.1.0.Final</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>keycloak-war</artifactId>
<packaging>war</packaging>
<name>Keycloak Server</name>
<description />
Do I have to donwload the war project, the parent project? I do not know where to start.
First of all please be informed that it is recommended to use standalone Keycloak server - http://keycloak.github.io/docs/userguide/keycloak-server/html/server-installation.html)
And here some details how you are able to customize themes - http://docs.jboss.org/keycloak/docs/1.0-alpha-3/userguide/html/themes.html
You can unzip the keycloak-forms-common-themes-1.1.0.Beta2.jar and under login you can change the css and images and redeploy it

Including my own jar in a maven project. What groupId should I provide?

I'm new to using maven and am trying to include my own jar files in a maven project. This is described in the following link - https://maven.apache.org/general.html. In order to understand what the different fields meant in -
mvn install:install-file
-Dfile=<path-to-file>
-DgroupId=<group-id>
-DartifactId=<artifact-id>
-Dversion=<version>
-Dpackaging=<packaging>
-DgeneratePom=true
I took a look at this other link - http://maven.apache.org/guides/mini/guide-naming-conventions.html
Most of the fields are clear to me except the groupId. It says I have to own a domain? Can't I just include my jar in the project without owning a domain?
Here is the pom generated after I use the install command -
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>sorting</groupId>
<artifactId>Algorithms2</artifactId>
<version>1.0</version>
<description>POM was created from install:install-file</description>
</project>
When you create java files, you should have a package name also. It is probably a good idea to use some prefix substring of that package name as a guideline for the groupId.

Categories

Resources