Build Pipeline with Jenkins - M2 Release -> Deployment to JBoss AS - maven

I am using Jenkins as CI environment and I want to have the ability to deploy the build artifacts directly to a JBoss AS 7.1.1 server. For releasing the Maven artifacts I am using the Jenkins M2 Release Plugin.
The project structure of the project which makes problems looks as follows:
artifact-parent-pom
webapp-module
theme-module
The maven goal jboss-as:deploy can only be called on webapp-module.
To deploy the webapp-module to the JBoss server on every build, I added a post-build step calling
mvn jboss-as:deploy
on the sub-module. This works perfectly for standard SNAPSHOT builds, but not for release builds.
When using the Jenkins M2 Release Plugin to release a new artifact version, the version number is already updated to the next SNAPSHOT-version when the post-build step is executed. I tried to deploy the release version directly at the release step, but this doesn't work, hence the goal jboss-as:deploy cannot be called on the parent-pom.
All Jeknins plugins i have found only support older versions of JBoss like
Deploy to container Plugin
JBoss Management Plugin
Is there an easy way to get this working?

I have found a workaround. I made two configurations, one for the SNAPSHOTS and one for the RELEASE builds. At the RELEASE build I added two post-steps both calling the goal version:set on the parent-pom but with different properties. This results in the following post-steps:
mvn newVersion=${MVN_RELEASE_VERSION}
mvn jboss-as:deploy
mvn newVersion=${MVN_DEV_VERSION}

Related

Maven multi-module project only deploy -SNAPSHOT modules in mvn deploy

I have a snapshot and a release repository defined in the pom.xml of all modules
The modules in my project may be developed and updated independently, i.e. one may be updated (and hence be -SNAPSHOT) during development whereas all others are untouched with release versions
My release nexus repository prevents redeployment
Running mvn deploy will successfully deploy -SNAPSHOT projects to the snapshot repository as required but when it tries to reploy one of the unchanged modules the build fails because that module is already in the release repository
I do not want releases to be redeployable - once a release is deployed it is final
Is there a way to run "mvn deploy" such that all snapshot bundles do get deployed but release modules are skipped?

jenkins m2 release deploy only one artifact

using jenkins m2 release plugin automatically sends some request to maven-deploy-plugin. this enables deploy of all artifacts. How can I stop this and deploy only specific artifact?
Solved by settings in pom.xml files of parent project (disable default deploy). Because parent is transefered to child - the deploys stop on all project.
after that I found the project which contained files i needed and supplied goal deploy:deploy-file and inside pom.xlm configured the goal.
m2 release plugin can send -Darguments="..." where you can set parameters for inner build. that's where I call deploy:deploy-file.
this is answer to close question.

Maven- Deploy release version of jar

I am new to maven and I'm using the maven release plugin to do a release and the maven deploy to deploy it. What I am noticing is that when I do
mvn release:prepare it makes two commits, as it should be, with the first one being without the snapshot in the pom.xml and then a newer version in the pom.xml with the snapshot. However when I then do mvn deploy it deploys the snapshot jar to my internal repository. How will I get it to deploy the release version of my jar? Should I be checking out HEAD~1 and then do mvn deploy?
Your question is slightly unclear, but the goal to run after release:prepare is release:perform.
Depending on what you're trying to do, the install or deploy plugins may also be useful.
Sonatype, the people that run Maven Central, have a very helpful guide to using the release plugin, as well as other ways of releasing:
http://central.sonatype.org/pages/apache-maven.html#performing-a-release-deployment-with-the-maven-release-plugin

Remove SNAPSHOT suffix from Jenkins build

I recently upgraded from hudson to jenkins. Since they are practically the same I thought it would be just plug and play. I noticed that when I build my projects my war files are being appended with the SNAPSHOT version instead of just .war. I didn't have this problem in hudson.
Is there a way to globally tell jenkins to use the release war, the one in my target directory, as it's artifact build file or have jenkins, I'm assuming the maven plugin, to not append the SNAPSHOT to the file?
SNAPSHOT is added on purpose. Don't mess with it. Either use bleeding-edge or perform mvn release:prepare release:perform in batch mode from Jenkins.

Maven Release plugin, version plugins and snapshots

I am trying to automate the release of interdependent projects. Here is the scenario. I have two projects: A and B. Project B has a dependency on project A. Here are the steps that need to happen in the automated procedure:
Release project A using maven-release-plugin. ( I know how to do this). Here is the sequence of goals I have defined:
release:clean release:prepare -DcommitByProject=true -DautoVersionSubmodules=true release:perform
Deploy the latest SNAPSHOT version of project A to the repository. (Using simply deploy is working. However there is a slight catch, which I've described below.)
Update the SNAPSHOT dependency version of project A in project B to the latest release version before doing a full release. In order to achieve this I've set the preparationGoals like this (clean verify versions:use-latest-versions versions:commit) in project B's POM file.
Everything seems to work fine.
Now what I want is that once the release is complete, Project A dependency in Project B to the latest SNAPSHOT version that was set during the release by the release:prepare plugin.
The solution I came up with was to do a maven deploy for project A SNAPSHOT right after the release:perform was executed. (New goal sequence for project A: release:clean release:prepare -DcommitByProject=true -DautoVersionSubmodules=true release:perform clean install deploy)
Then, I can execute a versions:use-next-snapshots at the end of the project B's release cycle.
(New goal sequence for project B: release:clean release:prepare -DcommitByProject=true -DautoVersionSubmodules=true release:perform versions:use-next-snapshots). Here I do restrict my versions plugin to handle only Project A dependencies.
The trouble is that when I execute the goals for Project A. Maven deploys the SNAPSHOT with the old version and not the incremented version. So if version before release for project A was 1.1-SNAPSHOT. The version after release is now 1.2-SNAPSHOT. The release version will be 1.1. However, project A snapshot version deployed is 1.1-SNAPSHOT and not 1.2-SNAPSHOT.
I am guessing that maven is not updating the pom in memory after the maven-release-plugin goals are executed.
have you considered making both projects belong to a parent project. then you release the parent project which in turn releases each module (sub project) automatically

Resources