Maven: Deploying from an existing tag? - maven

I'm trying to deploy the 32-bit and 64-bit versions of an artifact. I invoked release:prepare release:perform to deploy the 32-bit version but when I repeat the same command to deploy the 64-bit version (using the 64-bit profile) I get:
Checking in modified POMs...
EXECUTING: cmd.exe /X /C "hg commit --message "[maven-release-plugin] prepare release release-1.46.1" C:\Users\Gili\Documents\boost-maven-project\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-maven-plugin\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-compiler\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-api\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-date-time\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-filesystem\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-graph\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-iostreams\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-math\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-program-options\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-random\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-regex\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-serialization\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-signals\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-system\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-test\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-thread\pom.xml C:\Users\Gili\Documents\boost-maven-project\boost-wave\pom.xml"
[ERROR]
EXECUTION FAILED
Execution of cmd : commit failed with exit code: 1.
Working directory was:
C:\Users\Gili\Documents\boost-maven-project
Your Hg installation seems to be valid and complete.
Hg version: 1.8.2 (OK)
EXECUTING: cmd.exe /X /C "hg push https://boost-maven-project.googlecode.com/hg/"
Tagging release with the label release-1.46.1...
EXECUTING: cmd.exe /X /C "hg tag --message "[maven-release-plugin] copy for tag release-1.46.1" release-1.46.1"
[ERROR]
EXECUTION FAILED
Execution of cmd : tag failed with exit code: -1.
Working directory was:
c:\users\gili\documents\boost-maven-project
Your Hg installation seems to be valid and complete.
Hg version: 1.8.2 (OK)
If I invoke release:perform alone, I get:
[ERROR]Cannot perform release - the preparation step was stopped mid-way. Please re-run release:prepare to continue, or perform the release from an SCM tag.
How can I release:perform from an existing SCM tag? I tried adding -Dtag=foo but got the same error message.

Answering my own question. You can use:
mvn release:perform -DconnectionUrl=scm:hg:https://boost-maven-project.googlecode.com/hg/
but there is no way to specify a tag for Mercurial repositories. I filed this bug report: https://issues.apache.org/jira/browse/MRELEASE-969
UPDATE: According to https://stackoverflow.com/a/18943705/14731 you should be able to set the tag by creating release.properties, but I have not tested this.

Related

Maven release branch fails with error=7, Argument list too long

We have recently migrated our multimodule(each module with a pom.xml) repository from SVN to GIT.SCM connection in all pom.xml files updated from svn to git.
When i am trying to create a branch from git repository using maven release plugin it fails with the below error
"Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5:branch (default-cli) on project intgr: An error is occurred in the checkin process: Exception while executing SCM command. Error while executing command. Error while executing process. Cannot run program "/bin/sh" (in directory "/u01/remote-agent-home/xml-data/build-dir/IN-CDBFG-JOB1/mahirepository"): error=7, Argument list too long -> [Help 1]"
On examining logs i understand below command generated this error.
"[INFO] Checking in modified POMs... [INFO] Executing: /bin/sh -c cd /u01/remote-agent-home/xml-data/build-dir/IN-CDBFG-JOB1/mahirepository && git add -- intgr-parent/pom.xml archetypes/pom.xml and 1000 more pom files "
Is there a way i can workaround or fix this issue?
Maven version : Apache Maven 3.0.4
JDK version : 1.7.0_01
Maven command :
mvn -s ./settingsBamboo.xml --batch-mode release:branch -DbranchName=${bamboo.branchname} -DupdateWorkingCopyVersions=true -DsuppressCommitBeforeBranch=true -DautoVersionSubmodules=true -DremoteTagging=false -DupdateBranchVersions=false -X
I am currently facing this problem as well, but I got a bit further on this.
The issue has nothing to do with Java or Maven, it's a Linux limitation.
using getconfig MAX_ARGS you can find the max amount of bytes you can use as arguments.
Large maven commands can easily go beyond this, and the amount of bytes differs largely per distro.
Check the amount of bytes you can use, and try to get your command below that.
You could for example move into the build dir first, and then run the command relative.
Another solution would be to increase the amount of usable space, but I have so far not gotten that working.
If anyone does or you have fixed this yourself, let me know.

build failure Jenkins+Maven+SVN

Started by user xxx
Building in workspace C:\Users\Vinay.jenkins\workspace\Orbit App Automation
Updating https://polarisdev.svn.cloudforge.com/qaautomation at revision '2017-12-01T11:04:13.362 +0530'
Using sole credentials xxxx/****** in realm ‘https://polarisdev.svn.cloudforge.com:443 CloudForge login’
At revision 5
No changes for https://polarisdev.svn.cloudforge.com/qaautomation since the previous build
[qaautomation] $ cmd.exe /C "D:\apache-maven-3.5.0\bin\mvn.cmd -f pom.xml '"-Dmaven.repo.local=C:\Users\Vinay.jenkins\workspace\Orbit App Automation.repository"' clean install && exit %%ERRORLEVEL%%"
POM file pom.xml specified the -f/--file command-line argument does not exist
Build step 'Invoke top-level Maven targets' marked build as failure
Sending e-mails to: vinaya.mopidi#orbitanalytics.com
Finished: FAILURE
It is working now ,earlier i have given incorrectly Repository URL (svn url) now given up to svn work space
Correct : https://xxxx.svn.xxx.com/qaautomation/xxxAutomation
InCorrect : https://xxxx.svn.xxx.com/qaautomation
Build step 'Invoke top-level Maven targets' marked build as failure because you entered your shell script in maven goals and options input field.
You command seems to be a free style windows command script .
cmd.exe /C "D:\apache-maven-3.5.0\bin\mvn.cmd -f pom.xml '"-Dmaven.repo.local=C:\Users\Vinay.jenkins\workspace\Orbit App Automation.repository"' clean install && exit %%ERRORLEVEL%%
Select the execute windows batch command radio button in the build step.

Unable to execute maven command on jenkins

I have a jenkins job that checks out code from TFS and executes a test class using testng.xml
I have Maven properly installed in my machine in C:\JenkinsDependencies\apache-maven
It has mvn.bat file in its bin folder.
But when I execute my job, it fails with the following error.
Checking for pre-build
[TFS_LN_Mobile] $ cmd.exe /C '"C:\JenkinsDependencies\apache-maven\bin\mvn.bat test && exit %%ERRORLEVEL%%"'
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
Build step 'Invoke top-level Maven targets' marked build as failure
Checking for post-build
Finished: FAILURE
Below is the configuration of my jenkins job:
I manually executed a batch command as follows:
cd "C:\JenkinsRoot\workspace\TFS_LN_Mobile"
mvn test -DsuiteXmlFile=testng.xml
This works fine.
mvn.bat is a batch script. you can try adding trace of it's variables after steps that might produce this error. take a look at this: Is there any way to trace through the execution of a batch file?

Maven not recognized in Jenkins

I have installed Tomcat 7 on Windows 8, on which Jenkins is deployed. I configured the JDK, Ant and Maven in the Jenkin settings. In the Maven section, I gave a name as LocalMaven and the MAVEN_HOME as C:\Techie\apache-maven. When I did a test build, it gave me the following error that the mvn.bat is not recognized. Then I checked by entering mvn command in CMD. It gave some maven statements, which means maven is available in the PATH variables.
After googling, I changed the MAVEN_HOME as **%M2_HOME%\bin** in Jenkin-Maven configuration. Still it did not work.
LOG:
[workspace] $ cmd.exe /C '"mvn.bat -f HighScoresServiceClient compile && exit %%ERRORLEVEL%%"'
'mvn.bat' is not recognized as an internal or external command,
operable program or batch file
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE
Edited: Added the analysis
The command executed by Jenkins is [workspace] $ cmd.exe /C '"mvn.bat -f String-replacer compile && exit %%ERRORLEVEL%%"' where mvn.bat is not a valid command and so Jenkins errors out as follows that 'mvn.bat' is not recognized as an internal or external command, I think Jenkins should call the command as mvn and not mvn.bat. Can some experts correct me if I am wrong? Please let me know how to change this behaviour if I am right.
Edited: Attached the Configuration
I suppose your Tomcat server is running as a Windows service.
Did you create your MAVEN_HOME and M2_HOME as system environment variables? (idem for your PATH)
Another solution is to configure your variables in the apache-tomcat/bin/setenv.bat file:
set MAVEN_HOME=C:\Techie\apache-maven
set PATH=%MAVEN_HOME%\bin;%PATH%
I bet you've installed Maven 3.3 that has mvn.bat renamed to mvn.cmd
There is a report on this issue in Jenkins JIRA: https://issues.jenkins-ci.org/browse/JENKINS-27525

Hudson Release failure with error 'Unable to tag SCM'

When giving release from hudson getting the below error
mavenExecutionResult exceptions not empty
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.1:prepare (default-cli) on project parent: Unable to tag SCM
Provider message:
The svn tag command failed.
Command output:
svn: E235000: In file 'subversion/libsvn_client/commit_util.c' line 479: assertion failed ((copy_mode_root && copy_mode) || ! copy_mode_root)
/bin/sh: line 1: 23797 Aborted (core dumped) svn --username user --password 'pass*123' --no-auth-cache --non-interactive copy --file /tmp/maven-scm-1635387492.commit . http://codeserver.ennovate.com/source-repository/parent/tags/parent-4a.1503.2
I don't have any existing tag as /tags/parent-4a.1503.2/
I checked my credential and it was correct
Please help me to solve the problem
We found the same problem. There is one more report here:
https://mail-archives.apache.org/mod_mbox/subversion-users/201201.mbox/%3C2B173B138EFF584C846A48D41EFA3B420190AE53#server.tc.local%3E
Basically, if you have different ways to refer to the subversion server, for example, server and server.domain.com, you checkout a working copy from "server", but in the Maven root POM the SVN configuration points to server.domain.com, you will find this error.
You have to enter the same name in the elemento in the root POM, and in the svn command used to check-out a project from the Subversion sever.

Resources