The main idea of the question is: is that a way to specify that maven release should skip tagging when performing a release?
I have the following context: we have a TFS (Team Fundation Server) as a system that version our software. We also use a svn bridge that "talks" with the TFS and developers and CI tools use it. When performing a mvn release:clean release:prepare release:perform maven complains that it cannot find or create a tag (somehow translating the tag command of the svn into a similiar command in tfs crashes). Any suggestions are appreciated.
The error looks like this:
28-May-2013 15:51:04 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.4.1:branch (default-cli) on project spring-hibernate-mysql: The scm url is invalid.
28-May-2013 15:51:04 [ERROR] - scm:svn:https://${TFS_SERVER}:${PORT}/${PATH_TO_APP}/tags/dbDiagnostic-1.0.0-RELEASE url isn't a valid svn URL.
28-May-2013 15:51:04 [ERROR] -> [Help 1]
I mention that the url is ok, because the step before this, in a CI plan is a "checkout sources" step with the same url.
The maven release plugin depends on the svn tag as it checks out the tagged version during the release process. So the answer is: No, there is no way to release without a tag.
The svn URL above is not valid, you should consider fixing it by resolving the variable substitutions.
To your question:
You can disable remote tagging by setting the remoteTagging property to false as described in: http://maven.apache.org/maven-release/maven-release-plugin/prepare-mojo.html#remoteTagging
Note that in only works with SVN.
However, the reason for this error is most likely because maven failed to create the tag in the previous step, due to e.g. authentication failure or incorrect URL configuration ( see "tag base" attribute & etc ).
Related
I want to build a release version of my spring application with maven without the use of scm or ANY OTHER version control system - All I want is to build an application ready to be served via tomcat. While this sounds simple, it seems impossible for me to achieve.
I already tried options like suppressCommitBeforeTag / remoteTagging / pushChanges / dryRun directly via the command line
mvn -DremoteTagging=false -DsuppressCommitBeforeTag=true -DpushChanges=false release:prepare or by setting inside the pom.xml in the corresponding plugin configuration.
No matter what I do, I always get
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-release-plugin:3.0.0-M1:prepare
(default-cli) on project eStore: Missing required setting: scm
connection or developerConnection must be specified.
How can I completely deactivate version control / remote tagging when releasing?
Pretty much what the title say.
I am trying to build a CI/CD for WSO2. While following this tutorial:
https://docs.wso2.com/display/IntegrationCloud/Implement+Continuous+Integration+and+Deployment+with+Jenkins
It don't say anything about adding a DistributionManagement on the POM and it even has a special POM configuration section, but nevertheless, jenkins is throwing a
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project HelloWorld: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
So, if jenkins already has the repo URL, the branch and the github, and the POM has a deploy goal that should deploy to a URL:
1) why do I need the Distribution Management?
2) Can I point it to any location like my file system or do I have to point it to the cloud I actually want to deploy to?
according to maven documentation you can upload your build artifact directly to a server with maven using the tag distributionManagement
https://maven.apache.org/pom.html
the important part is the url tag. you can use scp or sftp (maybe other protocols)
scp://user:password#serverUrl/var/some/directory
I would recommend to test locally the command deploy and when you are sure it works, use jenkins.
If you want to make a state of the art jenkins job, I would recommend to use jenkins pipeline, execute maven with sh command and publish to a server using ssh steps provided by ssh-steps-plugin
We are trying to run release:prepare but this produces error like below.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:
prepare (default-cli) on project test-module:
Missing required setting:
scm connection or developerConnection must be specified. -> [Help 1]
We want to avoid setting the scm.connection manually.
How to set scm.connection automatically to the current URL? - For SVN and git.
The information must be somewhere within the (metadata of the) module, since svn info displays the value under URL.
In principle, you should be able to set the developerConnection by using a parameter, but (thanks to khmarbaise for telling me) there is a bug (https://issues.apache.org/jira/browse/MRELEASE-1017) so that this does not work at the moment.
I currently work around this with my own Maven plugin. It compares the connection and developerConnection entries of the pom with the url provided by the build server (the build server knows the url because it checked out the code) and adjusts the urls if necessary (followed by scm:checkin).
The versions of my system are the following:
Jenkins ver. 1.633
Ubuntu version 14.04.2 LTS
Maven version 3.0.5
I have configured the Maven settings under "Manage Jenkins"-->"Configure system".
When I create an "Invoke top-level Maven targets" step in the "Pre Steps" section everything works as expected. In the "Goals" line I can specify "-X", "clean install", etc. and maven picks this Goals up by printing for example :
[DEBUG] Reading global settings from .../settings.xml
[DEBUG] Reading user settings from .../settings.xml
[DEBUG] Using local repository at .../repository
When I set the same goals (for example -X) in the "Goals and options" input field of the "Build section" I get only the following Jenkins console output:
Parsing POMs ERROR: Failed to parse POMs
org.apache.maven.project.ProjectBuildingException: Some problems were
encountered while processing the POMs: [FATAL] Non-resolvable parent
POM: Failure to find nl.icscards:ics-build-parent:pom:1.1.8 in
http://repo.maven.apache.org/maven2 was cached in the local
repository, resolution will not be reattempted until the update
interval of central has elapsed or updates are forced and
'parent.relativePath' points at wrong local POM # line 6, column 10
at
org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:364)
at hudson.maven.MavenEmbedder.buildProjects(MavenEmbedder.java:361)
at hudson.maven.MavenEmbedder.readProjects(MavenEmbedder.java:331)
at
hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1301)
at
hudson.maven.MavenModuleSetBuild$PomParser.invoke(MavenModuleSetBuild.java:1098)
at hudson.FilePath.act(FilePath.java:991) at
hudson.FilePath.act(FilePath.java:969) at
hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.parsePoms(MavenModuleSetBuild.java:960)
at
hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:679)
at
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
at hudson.model.Run.execute(Run.java:1741) at
hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:531) at
hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:408) Finished: FAILURE
What I expect by specifying "-X" is to get some debugging information the same way as I do when invoking "Invoke top-level Maven targets" as a pre build step like I've shown above.
Please also note that everything works as expected as well if I create a "Freestyle project" instead of a "Maven Project" and execute there a shell statement of the form
cd <job_workspace>
mvn -X clean install
Also in this case I can see the expected output.
Any suggestions of what could be wrong in my "Maven project" jenkins configuration?
Thanks in advance for any replies.
Turns out that the problem was that maven could not find the parent pom which is an external dependency to the project.
The strange thing is that a Maven Jenkins project tries to get these dependencies even before maven can print debug information like which settings file it uses on the jenkins console. Therefore it fails, but it is difficult to guess what the issue is. I thought that it couldn't pick up the right repository path or the right settings.xml file.
In my case the issue was that in the parent pom dependency in the repository I have a file
parent.pom.lastUpdated
which contains a line:
http\://<private-VPN-host>/repo/repo-central/.lastUpdated=1439803113007
From the jenkins server I don't have access to the private VPN host and therefore it fails. Removing that file or the above line solves the problem.
The dependency is than correctly picked up and the maven project builds correctly.
I am using the tycho-p2-publisher-plugin in order to create a p2 site which can be uploaded to Nexus as described at Tool for managing/hosting own p2 repositories? - it aimed to be a work-around for the fact that Nexus does not seem to support hosted p2 repositories.
My problem is: the p2 artifacts are created fine and are even uploaded to Nexus whenever I do a snapshot build. However, when I try a release build, the build fails because of
[INFO] INFORMATION: I/O exception (java.io.FileNotFoundException) caught when processing request: /home/hudson/jobs/jobname/workspace/our.component.build/target/checkout/our.component.repository/target/p2content.xml
[INFO] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.5:deploy (default-deploy) on project our.component.repository: Failed to deploy artifacts: Could not transfer artifact our.component:our.component.repository:xml:p2metadata:1.1.18 from/to releases (http://192.168.205.205:8081/nexus/content/repositories/releases): /home/hudson/jobs/jobname/workspace/thirdparty/our.component.build/target/checkout/our.component.repository/target/p2content.xml (Datei oder Verzeichnis nicht gefunden) -> [Help 1]
p2content.xml is not found, simply because it's not there. The question is, should it be there?
I am using the maven release plugin, and as far as I understand, during the release build process, all components are prepared, then checked in and tagged with the release version. After that, they are checked back out from the tag, and then the build is started. As obviously the release build is run for the checkout folder (as seen above: .../target/checkout/...), the problem seems to be that p2context.xml is created by the tycho-p2-publisher-plugin during the build, but not checked in, while later it is expected to appear in the checkout folder. I would guess that Maven should not expect the file there and try to deploy it to Nexus, but I fail to understand why is it expected to be there? And what's the right approach to cure my release build?