Giter VIP home page Giter VIP logo

Comments (4)

khmarbaise avatar khmarbaise commented on August 15, 2024

From what kind of Java API ? And why? The plugins use the maven-plugin-api and the attributes are injected ?

from build-helper-maven-plugin.

sathomps avatar sathomps commented on August 15, 2024

I'm writing a Jenkins plugin for work to release a set projects. Part of the release process is to remove SNAPSHOT & increment to the next version. I could write this myself but I'd rather reuse your functionality.

I could make an external process call but that gets a bit messy.

I'm current using
FieldUtils.writeField(this, "project", project.getMvnProject(), true); FieldUtils.writeField(this, "versionString", project.getMvnProject().getVersion(), true);
but that's not maintainable really.

from build-helper-maven-plugin.

khmarbaise avatar khmarbaise commented on August 15, 2024

You know things like this:

mvn build-helper:parse-version versions:set \
     -DnewVersion=\${parsedVersion.nextMajorVersion}.0.0 \
     versions:commit

which can be done in a pipeline very easy? Another option would be to use maven-release-plugin ?

Furthermore if you have a dependency on the build-helper-maven-plugin you would get a large number of dependencies (transitively) which you don't need nor you like to have them in a Jenkins plugin...

Another hint: If you like to reuse code you can use the DefaultVersioning class which is really doing the parsing of the versions...The code in the plugin looks like this:

        DefaultVersioning artifactVersion = new DefaultVersioning( version );

By using artifactVersion you can now access the major, minor and patch version via:

int major = artifactVersion.getMajor();
int minor = artifactVersion.getMinor();
...

And you don't need to access ParseVersionMojo which will not work in the environment of a Jenkins plugin cause there many things which are injected by Maven which will not working in Jenkins plugins...

from build-helper-maven-plugin.

sathomps avatar sathomps commented on August 15, 2024

Well I do have it working in Jenkins :) Doesn't matter in the end as I need to walk the project tree anyways and this won't help, using the code I had before.

from build-helper-maven-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.