How to release with Maven in continuous integration? - java

A philosophic question with Maven in continuous integration.
In Maven we had the famous command mvn release:release to release the project. This changes the release in the pom.xml.
Now, we use continuous integration/deployment, is there always any utility to release the project with the Maven way?

Your question could be reworded better but see this maven release plugin. Releasing a project is made in two steps: prepare and perform.
Maven Release Plugin

Related

How can i do a gradle publish on teamcity to publish a gradle build that uses the maven plugin?

I have teamcity currently configured to use the maven mojo, to publish the gradle jar as a nexus snapshot with just the gav.
I observe that if i use the maven plugin and do a gradle install in the IDE, i am able to see the generated pom.
1) Can i use this pom to publish the jar in nexus repo in teamcity ? I know that i can do it for a pure maven build by using it's pom.
2) Is there a way to not use this pom, and istead configure teamcity build steps to publish from gradle build directly ?
Gradle can of course take care of the publication. It will leverage the build information to produce a POM file that represents best what is declared in your project.
It will then be trivial to invoke that Gradle task from the Teamcity build.
Have a look at the publishing documentation for details on how to set it up.

Can you have both maven's and gradle in same java build?

We already started our project in mavens(spring mvc) but realized gradle is better for managing big to enterprise level builds like our project. Is there a way to keep mavens but also add on gradle to the same build?
And if yes, how would I add gradle to my existing maven project? thanks.
I guess you need to make a decision:
Invoke maven from gradle
Invoke gradle from maven
If your end goal is to move to gradle then I suggest invoking maven from gradle. It looks like there's a plugin here which will do the job

Jenkins - Ant Build Maven Deploy

I have a project with a complicated ant build that we would like to remain as ant at the moment (will be converted to maven eventually).
I am using jenkins at the moment to build/test our application. After build/test, I now want to push the built artefact to a Nexus repository.
For a Maven project, I can use the post build action "Deploy Artefacts to Maven Repository" to do this.
Whats the best way to structure my Jenkins jobs to achieve an ant build and then deploy the code to Nexus?
Have you seen the example Ant scripts in the Sonatype website?
They actually include pushing artefacts to Nexus:
http://central.sonatype.org/pages/apache-ant.html#signing-and-deployments-using-the-maven-ant-tasks
Or there is also some more docs at Sonatype:
http://books.sonatype.com/nexus-book/reference/staging-deployment.html#staging-ant

Maven plugin which calls gradle

Is there a maven plugin available which calls gradle?
It might sound strange, but my company still uses maven and I want to make some experiments with gradle on our jenkins server. :-)

How can I update maven version 2.x to a newest version?

there is anyway to update maven version in cmd?
I have installed maven2.x and i want the newest version, i have been looking for and I've found sth like this:
one:convert convert a Maven 1 project.xml (v3 pom) to a Maven 2 pom.xml (v4 pom).
one:deploy-maven-one-repository deploy an artifact into a Maven 1 remote repository.
one:install-maven-one-repository install an artifact into the Maven 1 local repository.
one:maven-one-plugin package a Maven 1 plugin.
some of this sentence update my maven version?
ty for advance.
Maven has no command to upgrade to Maven 3.X.
You should download and extract new version.
Download the latest Maven version and add the {installation folder}/bin to your Path.
The stuff you've quoted is for converting Maven 1.x projects to 2.x and in project.xml to pom.xml. Maven 1.x project files were written in Jelly, which is a whole different thing. Maven 2.x turned the build logic into fully-Java written plugins.
So, to clear things out -- there are two things:
If you want to upgrade to a newer version of Maven, you need to download it from Maven's site, or use a package manager such as apt, or whatever your distribution uses.
If you would like to migrate your projects from Maven 2.x to 3.x, this should normally work out of the box, unless you have a) your own custom plugins, or b) third-party plugins which depend on Maven 2.x API-s, which contain deprecated stuff. Normally, things will work out of the box for you. For more details on changes, you can always check the release notes.

Categories