I am setting up the jgitflow release tasks on bamboo for the first time. We have the nexus url defined in the parent pom and the below jgitflow configuration for a project inherited from it as below
<plugin>
<groupId>external.atlassian.jgitflow</groupId>
<artifactId>jgitflow-maven-plugin</artifactId>
<version>1.0-m5.1</version>
<configuration>
<scmCommentPrefix>[RELEASE] </scmCommentPrefix>
<pushReleases>true</pushReleases>
<pushFeatures>true</pushFeatures>
<pushHotfixes>true</pushHotfixes>
<noFeatureBuild>true</noFeatureBuild>
<noReleaseBuild>true</noReleaseBuild>
<noHotfixBuild>true</noHotfixBuild>
<keepBranch>false</keepBranch>
<autoVersionSubmodules>true</autoVersionSubmodules>
<allowUntracked>true</allowUntracked>
<pullDevelop>true</pullDevelop>
<pullMaster>true</pullMaster>
<allowSnapshots>true</allowSnapshots>
</configuration>
</plugin>
While the develop and master versiongs/tags are created and updated when I run the jgitflow:release-finish, the artifact that is built is not being pushed into the configured nexus server. Can anyone tell me if there is a certain bamboo thing I am missing or if there is anything wrong with jgitflow configuration?
I found the issue and resolved it.
I have noReleaseBuild defaulted to true in the jgitflow config (in pom.xml) to avoid building locally, but for the release-finish on bamboo, I am overriding the value by passing -DnoReleaseBuild=true. Unfortunately from the logs (after enabling via -X), I see that the finish task is not overriding the noReleaseBuild defaulted on pom.xml, due to which the release build is never deployed.
I removed the default config that I added in pom.xml and that resulted in pushing the artifacts to nexus configured url on parent pom.
Related
I did download the project from github without any problem, i provided th maven commands mvn clean install and the project build successfully but when it comes to run the tests i get the following error. Any hints? I'am providing my pom.xml file, i tried all the suggestions but nothing.
Does your pom.xml contains the plugin surefire tag ? If thats missing then maven wont download this plugin at runtime and hence the error. Also if its there but maven cant download then may be you have to allow internet connectivity or copy the jars manually inside the .m2 directory on the Jenkins/Node server machine.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
</plugin>
I am a newbie trying to deploy artifacts to maven central for the first time. I followed the directions to configure maven to deploy to a staging repository. The maven build reports success. When I go to look for my staging repository, I don't see it. When I search for my artifact by searching for "markgrand" the artifact is found.
The group ID is com.markgrand, so I am expecting to see a staging repository with a names that begins with "commarkgrand-", but there is none. What am I doing wrong?
It's been awhile, so I do not remember the exact detail. The problem was that I had told the maven plugin to do too much. I think i had a step in there to close the thing, which made it no longer a candidate for deployment. Here is the staging plugin XML that is working for me:
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
</configuration>
</plugin>
I am trying to release several maven projects together, by deploying them to oss.sonatype.org, then releasing them to Maven central.
I have a build pom, that I use to build several multi-module projects together. The build pom is not the parent pom, each separate multi-module project has its own parent pom.
In the build pom, I set up the nexus staging plugin:
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.3</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
What happens when I build, is that all the sub-modules are built and uploaded to nexus in a staging repo (say #4005). Then at the end the above plugin opens a new repository (say #4006), uploads just the build pom to it, then closes it. This means that my build pom gets released, but not any of the sub-modules.
Is there some way to explicitly control the life-cycle of this plugin? I want to open new repository at the start of the build, upload all sub modules to it, then close and release it.
If you build pom is NOT a parent, then the different multi-module projects do NOT have a configuration of the staging plugin either. So are they just being deployed via the deploy plugin? That would be a mixed use case that does not work.
You would have to configure your Maven projects so they all run in one reactor and all deploy with the staging plugin.
The only other option I can think of is to run the full build of all the multi-module children as a normal deployment into one or multiple staging repositories and then subsequently release them together with the remote control goals of the staging plugin. That would probably require some scripting or at least some testing how the order of everything works out.
Thanks in advance! I am new to Jenkins and Maven. Please clarify my query for better understanding.
After the build war getting deployed from Jenkins system to Artifactory location (created under the tags <distributionManagement>/<snapshotRepository> in parent pom.xml). How this is happening without any scripts configured in Jenkins?
Can I do the same for my own archive file to place in Artifactory from Jenkins system after the build? I exposed some jars and getting archived in Jenkins system during the build and expecting same to be placed in Artifactory after the build same as how war is getting placed in Artifactory.
PLugin details for deploy:
I have many webapps and parent/super pom.xml.All wars are getting deployed in artifactory repository.Now looking for solution to deploy common folder also (ProvidedDependencies_${version} - Created during build time) .
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.6</version>
<goals>
<goal>deploy-file</goal>
</goals>
<configuration>
<repositoryId>artifactory</repositoryId>
<generatePom>true</generatePom>
<url>${project.distributionManagement.snapshotRepository.url}</url>
<artifactId>${project.artifactId}</artifactId>
<groupId>${project.groupId}</groupId>
<version>${project.version}</version>
<file>/ProvidedDependencies_${version}</file>
</configuration>
</plugin>
Invoking mvn deploy deploys the artifact(s) that has (or have) been built during the current run to your local repository, Artifactory in your case. See Introduction to the Build Lifecycle.
A Jenkins Maven 2/3 project or a Free-style software project with an appropriate build step can be configured to invoke mvn deploy.
My SCM connection information:
<scm>
<connection>scm:svn:https://repo/project/trunk</connection>
<developerConnection>scm:svn:https://repo/project/trunk</developerConnection>
</scm>
My release plugin configuration:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<tag>RC</tag>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
Now when I run mvn release:prepare, instead of committing my tagged release under tags/RC, it does tags/RC/trunk. How do I stop it from adding trunk under RC?
Brian, you may be the victim of Maven's incomplete release:rollback feature. See my question on StackOverflow and the answer to it. If your tag already exists, Subversion (not Maven) will think you want to copy trunk inside the existing tag. Delete the tag and it will work - once. Try again and you'll get RC/trunk. Try yet again and you'll get an error from Subversion.
The solution is to svn delete the tag before you try to copy to it - we do this successfully from Maven during release:perform, by binding a couple of plugins to the deploy phase.
Basically:
Let release:prepare do its thing, create a tag with a unique name.
Bind org.codehaus.mojo:exec-maven-plugin:exec to the deploy phase to make it run during release:perform. Configure it to call svn delete <path to RC tag>.
Bind maven-scm-plugin:branch to deploy in order to create the tag fresh using Maven's SCM plugin.
This works for us and it has the added benefit that it gives us the unique tags too for reference. Worst case, you can ignore these tags.