I have a simple Maven project that has to produce artifact e.g. some-artifact I also have a job in Jenkins that does simple maven deploy to our internal Nexus repository. This is the value set in Jenkins in "Maven goals and options" field for the job:
clean source:jar deploy
Lets assume that the version of my maven module is 1.0:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>some.group</groupId>
<artifactId>some-artifact</artifactId>
<version>1.0</version>
</project>
Now, what I want to achieve is to detect that the artifact version is changed in SCM and to build this job each time version number is changed, e.g. after it is set to 1.1:
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>some.group</groupId>
<artifactId>some-artifact</artifactId>
<version>1.1</version>
</project>
The final goal is to have last version of some-artifact deployed on Nexus as soon as possible.
Is there any configuration or Jenkins plugin that allows such detection and job trigger?
source:jarintegrate in your your pom and do justmvn clean deploy...You can configure jenkins to be triggered on a change in SCM ...That's the default way to handle such things.. - khmarbaisesource:jaris not so important, the point is to trigger the job. If I trigger it on every change from SCM, deploy goal will fail since the version is same like the previous one (fail is actually OK, but at this moment we don't have some "clever" version management). - user2310395