Maven build hanged with release and gpg plugins - maven

I've been struggling with a Maven 3.0.5 build, trying to deploy to Sonatype repo, using maven release plugin and maven gpg plugin in a Windows XP system. My problem is exactly the same as this SO question, but none of the solutions provided there is working for me.
The relevant fragments of my pom.xml are:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
<!-- see http://jira.codehaus.org/browse/MGPG-9 -->
<mavenExecutorId>forked-path</mavenExecutorId>
</configuration>
</plugin>
<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<configuration>
<passphrase>${gpg.passphrase}</passphrase>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<scm>
<connection>scm:git:https://github.com/pentasoft/s3-static-uploader.git</connection>
<developerConnection>scm:git:https://github.com/pentasoft/s3-static-uploader.git</developerConnection>
<url>https://github.com/pentasoft/s3-static-uploader</url>
<tag>s3-static-uploader-1.0</tag>
</scm>
The ouptut of my build is the following:
---
[INFO] BUILD SUCCESS
[INFO] ---------------------------------------------------------------------
---
[INFO] Total time: 29.737s
[INFO] Finished at: Fri Jul 05 15:58:20 CEST 2013
[INFO] Final Memory: 16M/40M
[INFO] ---------------------------------------------------------------------
---
[INFO] Checking in modified POMs...
[INFO] Executing: cmd.exe /X /C "git add -- pom.xml s3-static-uploader-plugin\po
m.xml s3-static-uploader-example1\pom.xml"
[INFO] Working directory: c:\Inetpub\wwwroot\Pentasoft.git\s3-static-uploader
[INFO] Executing: cmd.exe /X /C "git status"
[INFO] Working directory: c:\Inetpub\wwwroot\Pentasoft.git\s3-static-uploader
[INFO] Executing: cmd.exe /X /C "git commit --verbose -F C:\DOCUME~1\jgg\CONFIG~
1\Temp\maven-scm-870876840.commit pom.xml s3-static-uploader-plugin\pom.xml s3-s
tatic-uploader-example1\pom.xml"
[INFO] Working directory: c:\Inetpub\wwwroot\Pentasoft.git\s3-static-uploader
[INFO] Executing: cmd.exe /X /C "git symbolic-ref HEAD"
[INFO] Working directory: c:\Inetpub\wwwroot\Pentasoft.git\s3-static-uploader
[INFO] Executing: cmd.exe /X /C "git push https://github.com/pentasoft/s3-static
-uploader.git master:master"
[INFO] Working directory: c:\Inetpub\wwwroot\Pentasoft.git\s3-static-uploader
The build hangs here.
I've tried all the solutions provided in the previously referenced SO question and all of them produce the same result.

After a long fight with this, there were two problems mainly. The first one was related to the urls specified in scm section of the pom.xml file. My schemas were https and github was prompting me for the user, but there were no output on the screen showing that prompt. So the first step was changing the url schemas to the following:
<scm>
<connection>scm:git:git#github.com:pentasoft/s3-static-uploader.git</connection>
<developerConnection>scm:git:git#github.com:pentasoft/s3-static-uploader.git</developerConnection>
<url>https://github.com/pentasoft/s3-static-uploader</url>
</scm>
where the https schemas have been replaced by the ssh schema.
After fixing this there was a second problem regarding to the ssh access to Github. When launching the build, Github was answering with the following:
The authenticity of host 'github.com (207.97.227.239)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)?
As in the previous problem these prompt doesn't show and the feel is that the build is hanged again. In order to fix this, I issued the command ssh -T git#github.com (see this Github guide) and I answered yes to that question in order to avoid that prompt in the future.
After all this the build is not hanged anymore (following the instructions of #AWhitford in the previously referenced SO question).
May be all this would have been easier with a non Windows box...

Related

How to add a directory to the bitbucket pipline environment?

I have a spring boot project that uses bitbucket pipelines for its CI/CD deployment.
It was working fine until I added a react front end to bundle with the project.
I added this to my pom.xml
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<configuration>
<target>
<copy todir="${project.build.directory}/classes/public">
<fileset dir="${project.basedir}/ob-frontend/build"/>
</copy>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
and now the pipeline fails with
[INFO] --- frontend-maven-plugin:1.12.1:npm (npm install) # scienta ---
[INFO] Running 'npm install' in /opt/atlassian/pipelines/agent/build/ob-frontend
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.360 s
[INFO] Finished at: 2022-05-29T11:06:17Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.12.1:npm (npm install) on project scienta: Failed to run task: 'npm install' failed. java.io.IOException: /opt/atlassian/pipelines/agent/build/ob-frontend doesn't exist. -> [Help 1]
I understand that the new plugin creates a new directory, and the bitbucket pipeline env isn't doing that, I'm unsure how to tell the pipeline to do that.
This answer helped me fix my issue:
https://stackoverflow.com/a/35498001/4831652
I wrapped the plugins in my pom.xml with
<pluginManagement>...</pluginManagement>
It looks like it didn't even get to executing your maven-antrun-plugin task because it's the frontend-maven-plugin which fails.
Running 'npm install' in /opt/atlassian/pipelines/agent/build/ob-frontend
...
/opt/atlassian/pipelines/agent/build/ob-frontend doesn't exist
Here /opt/atlassian/pipelines/agent/build must be the ${project.basedir} when it's cloned to the build agent filesystem (since you expect the results of the frontend build be available in ${project.basedir}/ob-frontend/build). So the error says the frontend source directory ${project.basedir}/ob-frontend doesn't exist for some reason.
Regarding your question on creating directories during build, there's an mkdir Ant task, which can be configured like so:
<configuration>
<target>
<mkdir dir="${basedir}/target/some-dir" />
...
</target>
</configuration>

Jmeter Maven Plugin - Remote server config with parameters in pom.xml

I am trying to execute a jmeter test using the maven plugin on a remote server leveraging a pom.xml file that is completely parameterized as below.(I was able to successfully run a maven-jmeter remote test, where the servername, port, protocol and other info are all hard coded in the jmx file.
My pom.xml file is below
<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>
<artifactId>jmeter-demo</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>jmeter-demo</name>
<url>http://maven.apache.org</url>
<description>
Executes a JMeter test.
</description>
<properties>
<webapp.protocol>http</webapp.protocol>
<!--<webapp.host>www.mozilla.com</webapp.host>-->
<webapp.host>fsa-mia-dev2.fsalabs.io</webapp.host>
<webapp.port>80</webapp.port>
<test.duration>30</test.duration>
<test.threads>10</test.threads>
</properties>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.jmeter</groupId>
<artifactId>jmeter-maven-plugin</artifactId>
<version>1.9.0</version>
<executions>
<execution>
<!--
1)
first test run warms up the webserver.
Used to fill caches.
With a different set of properties since it runs much shorter than a normal test
and also the rate of requests/second may be much lower.
Maybe also use a different URL set.
-->
<id>warmup</id>
<phase>integration-test</phase>
<goals>
<goal>jmeter</goal>
</goals>
<configuration>
<propertiesUser>
<!--Accesses urls for warmup (compiles JSPs, fills caches, ...)-->
<!--************Setup Config for Threadgroup 23***************-->
<threadgroup23.name>S23_SFA_Org_CO</threadgroup23.name>
<threadgroup23.Transactionname>T23_SFA_Org_CO</threadgroup23.Transactionname>
<threadgroup23.ThinkTime>5000</threadgroup23.ThinkTime>
<threadgroup23.comment>T23_SFA_Org_CO</threadgroup23.comment>
<!--number of threads to use-->
<threadgroup23.numberOfThreads>5</threadgroup23.numberOfThreads>
<!--delay of the test in seconds-->
<threadgroup23.scheduledDelay>0</threadgroup23.scheduledDelay>
<!--duration of the test in seconds-->
<threadgroup23.scheduledDuration>60</threadgroup23.scheduledDuration>
<!--how long till all threads are up and running in seconds-->
<threadgroup23.rampUp>1</threadgroup23.rampUp>
<threadgroup23.dataFile>/home/ubuntu/mproj/data/S23_SFA_Org_CO.dat</threadgroup23.dataFile>
</propertiesUser>
</configuration>
</execution>
</executions>
<configuration>
<testFilesIncluded>
<testFilesIncluded>01_SA_CU_GetCPS.jmx</testFilesIncluded>
</testFilesIncluded>
<!-- protocol, server and port of tested webapp -->
<propertiesUser>
<protocol>${webapp.protocol}</protocol>
<server>${webapp.host}</server>
<port>${webapp.port}</port>
</propertiesUser>
<resultsFileFormat>csv</resultsFileFormat>
<testResultsTimestamp>false</testResultsTimestamp>
<ignoreResultFailures>true</ignoreResultFailures>
<remoteConfig>
<startServersBeforeTests>true</startServersBeforeTests>
<serverList>10.36.14.170</serverList>
</remoteConfig>
<suppressJMeterOutput>false</suppressJMeterOutput>
<propertiesSystem>
</propertiesSystem>
<propertiesJMeter><log_level.jmeter>DEBUG</log_level.jmeter></propertiesJMeter>
</configuration>
</plugin>
</plugins>
</build>
</project>
The issue is.. jmeter-server detects a request to execute and almost immediately stops.
Here is the info from log file post run
[debug] JMeter is called with the following command line arguments: -n -t /home/ubuntu/mProj/src/test/jmeter/01_SA_CU_GetCPS.jmx -l /home/ubuntu/mProj/target/jmeter/results/01_SA_CU_GetCPS.csv -d /home/ubuntu/mProj/target/jmeter -j /home/ubuntu/mProj/target/jmeter/logs/01_SA_CU_GetCPS.jmx.log -r -R 10.36.14.170
[info] Executing test: 01_SA_CU_GetCPS.jmx
[info] Created the tree successfully using /home/ubuntu/mProj/src/test/jmeter/01_SA_CU_GetCPS.jmx
[info] Configuring remote engine for 10.36.14.170
[info] Using remote object: UnicastRef [liveRef: [endpoint:[10.36.14.170:37913](remote),objID:[-10468c89:14fba100421:-7fff, -1854422229136130507]]]
[info] Starting remote engines
[info] Starting the test # Fri Sep 11 01:42:27 UTC 2015 (1441935747716)
[info] Remote engines have been started
[info] Waiting for possible shutdown message on port 4445
[info] Tidying up remote # Fri Sep 11 01:42:29 UTC 2015 (1441935749973)
[info] Completed Test: 01_SA_CU_GetCPS.jmx
[INFO]
[INFO] Test Results:
[INFO]
[INFO] Tests Run: 1, Failures: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 25.280s
[INFO] Finished at: Fri Sep 11 01:42:35 UTC 2015
[INFO] Final Memory: 11M/57M
[INFO] ------------------------------------------------------------------------
(The pom-file works well without the remoteConfig - in localhost)
(There's no networking issues any where and the remote server is able to access the host and works when servername, port, protocol is hardcoded in jmx files)
Is this a known limitation of the maven-jmeter plugin?
First use a recent version of jmeter-maven-plugin, 2.8.3 as of 15th january 2019.
To pass parameters, enter in pom.xml as child of configuration:
<propertiesJMeter>
<BUILD_TAG>${project.version}</BUILD_TAG>
<threads>7</threads>
<duration>30</duration>
</propertiesJMeter>
And in jmeter, to use threads for example, you would use __P function:
${__P(threads,5)
This blog explains the whole process.

nexus-staging-maven-plugin refuse to upload after deferred deployment

I have a multi-module project that has nexus-staging-maven-plugin configured in parent pom.xml:
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.6</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<!--<autoReleaseAfterClose>true</autoReleaseAfterClose>-->
</configuration>
</plugin>
By default it should be inherited by all submodules (except those disabled using technique in How to disable nexus-staging-maven-plugin in sub-modules)
However, when I start deployment:
mvn clean deploy -DskipTests=true -Prelease-sign-artifacts -Dgpg.passphrase=*****
I see the following message:
[INFO] Installing Nexus Staging features:
[INFO] ... total of 5 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
...
[INFO] --- nexus-staging-maven-plugin:1.6.6:deploy (injected-nexus-deploy) # spookystuff-core ---
[INFO] Performing deferred deploys (gathering into "/home/peng/git/spookystuff/target/nexus-staging/deferred")...
[INFO] Installing /home/peng/git/spookystuff/core/target/spookystuff-core-0.3.2-SNAPSHOT.jar to /home/peng/git/spookystuff/target/nexus-staging/deferred/com/tribbloids/spookystuff/spookystuff-core/0.3.2-SNAPSHOT/spookystuff-core-0.3.2-SNAPSHOT.jar
...
[INFO] Reactor Summary:
...
[INFO] BUILD SUCCESS
No upload happens whatsoever. The artifact that should be uploaded to nexus were still cached under:
/target/nexus-staging/deferred
but neither the log nor nexus server record indicates that it has been uploaded. What has been wrong here and what should I do to fix it?

Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.2.2:prepare failed. NullPointerException

Here is the Context:
I have successfully built the project with the following commands (called from maven-release-plugin in Jenkins)
mvn clean -Pall
mvn generate-sources -Pgs
mvn -PjenkinsBuild install package assembly:single -Pall -Denvironment=dev
Now, when I try to release the project with maven-release-plugin in Jenkins, with the following commands. It failed.(error log and pom at the end)
mvn -X release:prepare release:perform
Tried some unsuccessful solutions:
1.Modified the config of maven-release-plugin, suspecting developers and Jenkins are using different vesion of SVN.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<branchBase>${svn.base}/branches/releases</branchBase>
<tagBase>${svn.base}/tags/releases/</tagBase>
<autoVersionSubmodules>true</autoVersionSubmodules>
<suppressCommitBeforeBranch>true</suppressCommitBeforeBranch>
<remoteTagging>false</remoteTagging>
<updateBranchVersions>true</updateBranchVersions>
<updateWorkingCopyVersions>false</updateWorkingCopyVersions>
<providerImplementations>
<svn>javasvn</svn>
</providerImplementations>
</configuration>
<dependencies>
<dependency>
<groupId>com.google.code.maven-scm-provider-svnjava</groupId>
<artifactId>maven-scm-provider-svnjava</artifactId>
<version>2.0.6</version>
<scope>compile</scope>
</dependency>
</dependencies>
</plugin>
Tried to added the groupID explicitly, according to one of the suggestions
tc.strongview
strongview-soap-client
jar
Strongview SOAP Client
And a section of the POM
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>tc.strongview</groupId>
<artifactId>strongview-etl-core</artifactId>
<version>0.2.0-SNAPSHOT</version>
<packaging>pom</packaging>
<scm>
<connection>
scm:svn:https://xxxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2
</connection>
<developerConnection>
scm:svn:https://xxxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2
</developerConnection>
<url>https://xxxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2
</url>
</scm>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<modules>
<module>strongview-etl-common</module>
<module>strongview-soap-client</module>
<module>strongview-etl-definitions</module>
</modules>
<distributionManagement>
...................................................
...................................................
...................................................
</distributionManagement>
<repositories>
...................................................
...................................................
...................................................
</repositories>
<profiles>
...................................................
...................................................
...................................................
</profile>
</profiles>
<properties>
...................................................
...................................................
...................................................
</properties>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>2.9</version>
</extension>
<extension>
<groupId>com.github.shyiko.servers-maven-extension</groupId>
<artifactId>servers-maven-extension</artifactId>
<version>1.3.0</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<branchBase>${svn.base}/branches/releases</branchBase>
<tagBase>${svn.base}/tags/releases/</tagBase>
<autoVersionSubmodules>true</autoVersionSubmodules>
<suppressCommitBeforeBranch>true</suppressCommitBeforeBranch>
<remoteTagging>false</remoteTagging>
<updateBranchVersions>true</updateBranchVersions>
<updateWorkingCopyVersions>false</updateWorkingCopyVersions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>${project.parent.basedir}/assembly/distribution.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
<finalName>${distribution.name}</finalName>
<includeProjectBuildFilters>true</includeProjectBuildFilters>
<ignoreMissingDescriptor>true</ignoreMissingDescriptor>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>wagon-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<serverId>${deployment.server}</serverId>
<fromDir>${project.build.directory}</fromDir>
<includes>${distribution.name}.zip</includes>
<url>scp://${etl.server.url}:${etl.server.distribution.dir}</url>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
...................................................
...................................................
...................................................
</dependencies>
New error log released with Maven 3.3.3 and maven-release-plugin 2.5.2 and simple "release:prepare release:perform"
Started by user
[EnvInject] - Loading node environment variables.
Building on master in workspace /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven
Cleaning up /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/.
Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/pom.xml.releaseBackup
Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/release.properties
Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/pom.xml
Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-etl-common/pom.xml.releaseBackup
Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-soap-client/pom.xml.releaseBackup
Deleting /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-etl-definitions/pom.xml.releaseBackup
Updating https://xxxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2 at revision '2015-08-04T15:33:30.474 -0400'
At revision 80
no change for https://xxxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2 since the previous build
Parsing POMs
[strongview-etl-core-Release4 - Latest Maven] $ /opt/jdk1.8.0_45/bin/java -Xmx2048m -XX:MaxPermSize=512m -cp /data/jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-agent-1.4.jar:/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.3/boot/plexus-classworlds-2.5.2.jar:/data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.3/conf/logging jenkins.maven3.agent.Maven31Main /data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.3 /var/cache/jenkins/war/WEB-INF/lib/remoting-2.36.jar /data/jenkins/plugins/maven-plugin/WEB-INF/lib/maven31-interceptor-1.4.jar /data/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.4.jar 35483
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=512m; support was removed in 8.0
<===[JENKINS REMOTING CAPACITY]===>channel started
log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
log4j:WARN Please initialize the log4j system properly.
Executing Maven: -B -f /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/pom.xml -DdevelopmentVersion=0.2.1-SNAPSHOT -DreleaseVersion=0.2.0 -X -Dresume=false release:prepare release:perform
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T07:57:37-04:00)
Maven home: /data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.3
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /opt/jdk1.8.0_45/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "2.6.32-279.14.1.el6.x86_64", arch: "amd64", family: "unix"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /data/jenkins/tools/hudson.tasks.Maven_MavenInstallation/3.3.3/conf/settings.xml
[DEBUG] Reading user settings from /home/jenkins/.m2/settings.xml
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] strongview-etl-core
[INFO] Strongview SOAP Client
[INFO] strongview-etl-common
[INFO] strongview-etl-definitions
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building strongview-etl-core 0.2.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.5.2:prepare (default-cli) # strongview-etl-core ---
[INFO] Verifying that there are no local modifications...
[INFO] ignoring changes on: **/pom.xml.releaseBackup, **/pom.xml.next, **/pom.xml.tag, **/pom.xml.branch, **/release.properties, **/pom.xml.backup
[INFO] Executing: /bin/sh -c cd "/data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven" && svn --non-interactive status
[INFO] Working directory: /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven
[DEBUG] ? release.properties
[DEBUG] Ignoring changed file: release.properties
[INFO] Checking dependencies and plugins for snapshots ...
[INFO] Transforming 'strongview-etl-core'...
[INFO] Ignoring artifact version update for expression ${project.version}
[INFO] Ignoring artifact version update for expression ${project.version}
[INFO] Transforming 'Strongview SOAP Client'...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] strongview-etl-core ................................ FAILURE [ 2.944 s]
[INFO] Strongview SOAP Client ............................. SKIPPED
[INFO] strongview-etl-common .............................. SKIPPED
[INFO] strongview-etl-definitions ......................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.724 s
[INFO] Finished at: 2015-08-04T15:33:41-04:00
[INFO] Final Memory: 20M/139M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare (default-cli) on project strongview-etl-core: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare (default-cli) on project strongview-etl-core: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.jvnet.hudson.maven3.launcher.Maven31Launcher.main(Maven31Launcher.java:132)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:330)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:238)
at jenkins.maven3.agent.Maven31Main.launch(Maven31Main.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:134)
at hudson.maven.Maven3Builder.call(Maven3Builder.java:69)
at hudson.remoting.UserRequest.perform(UserRequest.java:118)
at hudson.remoting.UserRequest.perform(UserRequest.java:48)
at hudson.remoting.Request$2.run(Request.java:328)
at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 31 more
Caused by: java.lang.NullPointerException
at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.translateUrlPath(AbstractRewritePomsPhase.java:847)
at org.apache.maven.shared.release.phase.RewritePomsForReleasePhase.translateScm(RewritePomsForReleasePhase.java:202)
at org.apache.maven.shared.release.phase.RewritePomsForReleasePhase.transformScm(RewritePomsForReleasePhase.java:64)
at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transformDocument(AbstractRewritePomsPhase.java:330)
at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transformProject(AbstractRewritePomsPhase.java:231)
at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.transform(AbstractRewritePomsPhase.java:131)
at org.apache.maven.shared.release.phase.AbstractRewritePomsPhase.execute(AbstractRewritePomsPhase.java:116)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:234)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:169)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:146)
at org.apache.maven.shared.release.DefaultReleaseManager.prepare(DefaultReleaseManager.java:107)
at org.apache.maven.plugins.release.PrepareReleaseMojo.prepareRelease(PrepareReleaseMojo.java:286)
at org.apache.maven.plugins.release.PrepareReleaseMojo.execute(PrepareReleaseMojo.java:240)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 32 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
[JENKINS] Archiving /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-etl-definitions/pom.xml to tc.strongview/strongview-etl-definitions/0.2.0-SNAPSHOT/strongview-etl-definitions-0.2.0-SNAPSHOT.pom
[JENKINS] Archiving /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-soap-client/pom.xml to tc.strongview/strongview-soap-client/0.2.0-SNAPSHOT/strongview-soap-client-0.2.0-SNAPSHOT.pom
[JENKINS] Archiving /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/strongview-etl-common/pom.xml to tc.strongview/strongview-etl-common/0.2.0-SNAPSHOT/strongview-etl-common-0.2.0-SNAPSHOT.pom
[JENKINS] Archiving /data/jenkins/workspace/strongview-etl-core-Release4 - Latest Maven/pom.xml to tc.strongview/strongview-etl-core/0.2.0-SNAPSHOT/strongview-etl-core-0.2.0-SNAPSHOT.pom
channel stopped
Finished: FAILURE
For me its resolved scm tag and release plugin moved to child pom. It means deleted scm tag and release plugin details from the parent pom
First what comes into my mind. Why are you using an ancient version of the maven-release-plugin 2.2.2 which is from 2011 ? Not an more uptodate version?
Why are you using an very buggy version of Maven 3.0.3 ? Not at least the final one of the 3.0.X release line (3.0.5) ?
Furthermore you are calling maven like this:
mvn clean -Pall
mvn generate-sources -Pgs
mvn -PjenkinsBuild install package assembly:single -Pall -Denvironment=dev
That shows that you didn't understand Maven's life cycle.
If you call mvn package will run all life cycle phase including install which means calling:
mvn install package
does not make sense.
Furthermore you are calling mvn ...assembly:single which does not make sense either. You should bind the execution of maven-assembly-plugin to the life-cycle. An other point you have configured in the pom file:
${project.parent.basedir}/assembly/distribution.xml
You should never leave the location of your current module by using a configuration like this, this will cause trouble.
A realy Maven build should always be callable by using the simple one like this:
mvn clean deploy
If you like to make a release it should work like this:
mvn release:prepare release:perform
If this does not work i'm not astonished you get trouble using your CI server.
Also you are violating the best practices in SVN...using tags/trunk/branches concept.
In the log i can see the following:
Building on master in workspace /data/jenkins/workspace/strongview-etl-core-Release
Checking out a fresh workspace because there's no workspace at /data/jenkins/workspace/strongview-etl-core-Release
Cleaning local Directory .
Checking out https://xxxxxxxx/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2 at revision '2015-08-04T10:08:20.758 -0400'
.....................................................................................................................
.....................................................................................................................
.....................................................................................................................
AU pom.xml
U .
At revision 77
no change for https://svn.transcontinental.ca/svn/strongview-etl-core/branches/releases/strongview-etl-core-0.2 since the previous build
[strongview-etl-core-Release] $ /bin/sh -xe /data/jenkins/tmp/hudson5945883868250298288.sh
+ cd /data/jenkins/workspace/strongview-etl-core-Release/
Which shows me that you are already on a tag which can't work, cause to do a release you should be either on a branch or trunk which contains the -SNAPSHOT version in your pom file...which does not look like it..

How to revert Maven project.build variables after Clover plugin finishes?

I'm attempting to add integration tests to a large Maven project. Here is the desired order of events:
Clean existing artifacts.
Resolve dependencies and build project.
Run unit tests via Surefire plugin.
Fork lifecycle for Clover plugin.
--- Instrument sources using Clover plugin.
--- Modify project.build.directory and project.build.finalName for Clover.
--- Build Clover instrumented project in a new directory.
--- Run Clover instrumented unit tests via Surefire plugin.
--- Check code coverage from Clover instrumented unit tests.
--- Reset project.build.directory and project.build.finalName to original values.
--- End forked lifecycle (Clover only forks through 'test' phase).
Package project as a WAR file.
Locally host project WAR file via Tomcat7 plugin.
Run integration tests against Tomcat7 instance via Surefire plugin.
All of this works as expected except step #9 (hence the question). Instead, the build directory is still set to the Clover version, and the project name has "-clover" appended to it. I've also found that when "MyProject-clover.war" is hosted by Tomcat7 that it does not function as expected (returns a 404 error in the browser).
Even if it did work, We do not need/want Clover instrumentation in the WAR file which we're testing against because the integration tests don't touch any of the production code (it's all Selenium UI stuff under src/test/java which interacts with the locally hosted pages instead of the production code itself).
As mentioned, this is a large project containing hundreds of dependencies and dozens of plugins. I believe the following are relevant to my issue, though I can dig up more if necessary (posting the entire pom file seems unreasonable).
Here's the pom configuration for the Clover plugin:
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<version>3.1.11</version>
<configuration>
<generateHtml>true</generateHtml>
<generateXml>true</generateXml>
<licenseLocation>${basedir}/src/test/resources/clover.license</licenseLocation>
<targetPercentage>92%</targetPercentage>
<excludes>
<exclude>**/mock/*.java</exclude>
<exclude>**/com/mycompany/somestuff/*.java</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>generate-clover-report</id>
<phase>test</phase>
<goals>
<goal>instrument</goal>
<goal>clover</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
Here's the pom configuration for the WAR plugin:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<finalName>${project.artifactId}</finalName>
<appendAssemblyId>false</appendAssemblyId>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<!--Implementation-Build>${buildNumber}_${timestamp}</Implementation-Build -->
<Build-Time>${timestamp}</Build-Time>
</manifestEntries>
</archive>
</configuration>
</plugin>
Here's the pom configuration for the Tomcat7 plugin:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<ajpPort>8009</ajpPort>
<backgroundProcessorDelay>2</backgroundProcessorDelay>
<configurationDir>${project.build.directory}/tomcat7_plugin</configurationDir>
<contextFile>${CATALINA_HOME}/conf/context.xml</contextFile>
<contextReloadable>false</contextReloadable>
<fork>true</fork>
<hostName>localhost</hostName>
<httpsPort>8443</httpsPort>
<ignorePackaging>false</ignorePackaging>
<jarScanAllDirectories>false</jarScanAllDirectories>
<path>/contentmain</path>
<port>8080</port>
<serverXml>${CATALINA_HOME}/conf/server.xml</serverXml>
<tomcatUsers>${CATALINA_HOME}/conf/tomcat-users.xml</tomcatUsers>
<tomcatWebXml>${CATALINA_HOME}/conf/web.xml</tomcatWebXml>
<useNaming>true</useNaming>
<useTestClasspath>true</useTestClasspath>
<update>true</update>
<warDirectory>${project.build.directory}/${project.build.finalName}</warDirectory>
</configuration>
<executions>
<execution>
<id>start-tomcat</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run-war-only</goal>
</goals>
<configuration>
<fork>true</fork>
</configuration>
</execution>
<execution>
<id>stop-tomcat</id>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>
Here's the current (desired) behavior when I run "mvn clean install -Dmaven.clover.skip":
[INFO] --- maven-clover2-plugin:3.1.11:check (generate-clover-report) # MyProject ---
[INFO]
[INFO] --- maven-dependency-plugin:2.1:unpack (unpack) # MyProject ---
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes css/*.css and excludes:null
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes scripts/*/*.* and excludes:null
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes images/*.* and excludes:null
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) # MyProject ---
[INFO] Packaging webapp
[INFO] Assembling webapp [MyProject] in [mydir/MyProject/target/MyProject]
[INFO] Processing war project
[INFO] Copying webapp resources [mydir/MyProject/src/main/webapp]
[INFO] Webapp assembled in [2019 msecs]
[INFO] Building war: /mydir/MyProject/target/MyProject.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] >>> maven-source-plugin:2.2.1:jar (default) # MyProject >>>
[INFO]
[INFO] --- maven-dependency-plugin:2.1:copy (default) # MyProject ---
[INFO]
[INFO] --- buildnumber-maven-plugin:1.1:create-timestamp (default) # MyProject ---
[INFO]
[INFO] <<< maven-source-plugin:2.2.1:jar (default) # MyProject <<<
[INFO]
[INFO] --- maven-source-plugin:2.2.1:jar (default) # MyProject ---
[INFO] Building jar: /mydir/MyProject/target/MyProject-sources.jar
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:run-war-only (start-tomcat) # MyProject ---
[INFO] Running war on http://localhost:8080/contentmain
Here's the current (undesired) behavior when I run "mvn clean install" (note the paths listed by maven-war-plugin and warning message from maven-source-plugin:
[INFO] --- maven-clover2-plugin:3.1.11:check (generate-clover-report) # MyProject ---
[INFO]
[INFO] --- maven-dependency-plugin:2.1:unpack (unpack) # MyProject ---
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Configured Artifact: com.mycompany:somedependency:?:jar
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes css/*.css and excludes:null
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes scripts/*/*.* and excludes:null
[INFO] Unpacking /mydir/.m2/myrepo/mycompany/somedir/somedependency.jar to mydir/MyProject/target/MyProject with includes images/*.* and excludes:null
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) # MyProject ---
[INFO] Packaging webapp
[INFO] Assembling webapp [MyProject] in [mydir/MyProject/target/clover/MyProject-clover]
[INFO] Processing war project
[INFO] Copying webapp resources [mydir/MyProject/src/main/webapp]
[INFO] Webapp assembled in [1770 msecs]
[INFO] Building war: /mydir/MyProject/target/clover/MyProject-clover.war
[INFO] WEB-INF/web.xml already added, skipping
[INFO]
[INFO] >>> maven-source-plugin:2.2.1:jar (default) # MyProject >>>
[INFO]
[INFO] --- maven-dependency-plugin:2.1:copy (default) # MyProject ---
[INFO]
[INFO] --- buildnumber-maven-plugin:1.1:create-timestamp (default) # MyProject ---
[INFO]
[INFO] <<< maven-source-plugin:2.2.1:jar (default) # MyProject <<<
[INFO]
[INFO] --- maven-source-plugin:2.2.1:jar (default) # MyProject ---
[WARNING] NOT adding sources to artifacts with classifier as Maven only supports one classifier per artifact. Current artifact [com.mycompany:MyProject:war:clover:ParentProject-SNAPSHOT] has a [clover] classifier.
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:run-war-only (start-tomcat) # MyProject ---
[INFO] Running war on http://localhost:8080/contentmain
What can I do to make sure that the {project.build.directory} and {project.build.finalName} values are reset to their original values after Clover has finished executing the maven-clover2-plugin:check goal during the test phase of the forked lifecycle?
I've already tried browsing the online manuals for Clover, the WAR plugin, and Tomcat7. I see no mention of any settings I can use to revert the build variables that are altered by Clover. I can always hard-code the paths in my pom file, but I'd prefer a less brittle solution.
[INFO] --- maven-source-plugin:2.2.1:jar (default) # MyProject ---
[WARNING] NOT adding sources to artifacts with classifier as Maven only supports one classifier per artifact. Current artifact [com.mycompany:MyProject:war:clover:ParentProject-SNAPSHOT] has a [clover] classifier.
This is a limitation of Maven. It does not support artifacts with multiple classifiers. As the artifact in a forked life cycle has the "clover" classifier already, it cannot have "source" classifier at the same time. That's why this warning is present. You may consider using the clover2:setup instead of the clover2:instrument if you need to call a maven-source-plugin.
4. Fork lifecycle for Clover plugin.
--- End forked lifecycle (Clover only forks through 'test' phase).
There are two Clover goals which forks a build:
clover2:instrument - forks a build till the 'install' phase
clover2:instrument-test - forks a build till the 'test' phase
You may be interested in the latter one. You may also be interested in using the useCloverClassifier=false option - this will disable usage of the "clover" classifier in a forked build.
I've also found that when "MyProject-clover.war" is hosted by Tomcat7 that it does not function as expected (returns a 404 error in the browser).
My first guess is that you have clover.jar (com.atlassian.clover:clover) missing at runtime. You have to either copy clover.jar to Tomcat's /lib directory or to bundle it in your WAR. See https://confluence.atlassian.com/display/CLOVER/Using+Clover+for+web+applications
It turns out that Clover will always alter these variables unless the clover2:setup target is used. However, if you still wish to fork the lifecycle for Clover (IE: clover2:instrument or clover2:instrument-test) then these variables will always be altered.
We wish to continue forking the lifecycle using clover:instrument-test, so I've come up with a workaround. Instead of using the project.build.finalName and project.build.directory variables, I'm using my own variables that get copied and saved on Maven execution before Clover can mess with them:
<properties>
<!-- Saving these variables now before Clover alters them -->
<original.build.finalName>${project.build.finalName}</original.build.finalName>
<original.build.directory>${project.build.directory}</original.build.directory>
</properties>
I then tell all of the subsequent plugins to use these variables instead of the project variables which Clover has altered:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<cacheFile>${original.build.directory}/war/work/webapp-cache.xml</cacheFile>
<outputDirectory>${original.build.directory}</outputDirectory>
<warName>${original.build.finalName}</warName>
<webappDirectory>${original.build.directory}/${original.build.finalName}</webappDirectory>
<workDirectory>${original.build.directory}</workDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<configurationDir>${original.build.directory}/tomcat7_plugin</configurationDir>
<warDirectory>${original.build.directory}/${original.build.finalName}</warDirectory>
</configuration>
</plugin>
</plugins>
Alternative solutions might include creating or utilizing an additional plugin in a subsequent Maven phase to revert the project.build variables after Clover has finished executing. Either of these solutions is probably better than hard-coding the paths in all of your plugins.

Resources