pascalgn / properties-maven-extension Goto Github PK
View Code? Open in Web Editor NEWMaven extension to supply build properties
License: Apache License 2.0
Maven extension to supply build properties
License: Apache License 2.0
Unfortunately the extension will only run with JDK 8:
Failed to initialize spy com.github.pascalgn.maven.properties.EventSpyImpl: org/eclipse/jgit/lib/AnyObjectId : Unsupported major.minor version 52.0
I have a need for the following git attributes:
I have already implemented the code and would like to push it up as a feature branch for review but I'm not allowed to create a branch in this project.
The format of https://maven.apache.org/plugins/maven-jar-plugin/jar-mojo.html#outputTimestamp
can be ISO 8601 or secs since epoch.
I need this to support https://maven.apache.org/guides/mini/guide-reproducible-builds.html#how-do-i-configure-my-maven-build
Hi. Clearly no-one is using the git.tag.last property like I am.
The "last tag from sorted tag list (v1.2.3)" is not useful for builds, since it takes the latest tag, whether those tags apply to a commit on the branch or not.
In other words, currently, if I tag a commit on another branch, it will change the version number of my projects built on ALL OTHER BRANCHES.
So instead of
git tag -l | tail -1
The behaviour should resemble
git describe --abbrev=0
This will only show annotated tags, but I would prefer this as it allows developers to use normal tags for other things and leave the a-tags for version tagging.
The first 6 characters of a git commit id also happen to describe a color, in hex format. Together with tools like color-names, we can get a mapping in the form
c9c17d544ffa0096c12cc90673ea836cf3399561 -> Dried Moss
It will not be a unique mapping, but it can still helpful for continuous deployment scenarios, where "Currently we have Dried Moss deployed" might be easier than "Currently deployed version is c9c17d".
We could add additional properties, maybe something like this:
git.commit.color.value # c9c17d
git.commit.color.name # Dried Moss
In README you described to use at least Maven 3.3.9 which will not work with the placeholders correctly . You need Maven 3.5.0.
The git.dir.worktree property should be determined from the location of the root project, not the working directory.
I found this using mvn --f . Its also applicable when using submodules.
Hi @pascalgn,
Is it possible to have a new property that will return commit count to git repo? (git rev-list HEAD --count
)
Thanks.
I use the directory-maven-plugin to get the root directory of the reactor, which happens to be the repository workspace.
https://github.com/jdcasey/directory-maven-plugin#highest-basedir-goal
But due to the way plugins work, that execution runs in every project in the reactor, even though I only need it in the root project.
I could ask the author to provide an extension of his plugin, but I thought why not implement in this extension instead?
Hi Pascal,
Is it conceivable for you that some of the properties are read in via any sources?
By the way:
At this second I don't know about maven extensions, but shouldn't maven complain about placeholders? 'version' contains an expression but should be a constant. @ com.acceo.stuff.abc:stuff-abc-parent:${MYPROJECT_VERSION}
Thanks
Torsten
I get error when I build from a directory I created as an alternative worktree git add worktree ../temp
[WARNING] Failed to initialize spy com.github.pascalgn.maven.properties.EventSpyImpl: Error while reading Git properties!
[INFO] Scanning for projects...
[ERROR] Internal error: java.lang.NullPointerException -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.NullPointerException
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:120)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
Caused by: java.lang.NullPointerException
at java.util.Hashtable$Entry.setValue (Hashtable.java:1286)
at org.apache.maven.model.interpolation.StringVisitorModelInterpolator$ModelVisitor.visit (StringVisitorModelInterpolator.java:1429)
at org.apache.maven.model.interpolation.StringVisitorModelInterpolator$ModelVisitor.visit (StringVisitorModelInterpolator.java:1027)
at org.apache.maven.model.interpolation.StringVisitorModelInterpolator$ModelVisitor.visit (StringVisitorModelInterpolator.java:170)
at org.apache.maven.model.interpolation.StringVisitorModelInterpolator.interpolateModel (StringVisitorModelInterpolator.java:107)
at org.apache.maven.model.building.DefaultModelBuilder.interpolateModel (DefaultModelBuilder.java:789)
at org.apache.maven.model.building.DefaultModelBuilder.build (DefaultModelBuilder.java:393)
at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:448)
at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:414)
at org.apache.maven.project.DefaultProjectBuilder.build (DefaultProjectBuilder.java:377)
at org.apache.maven.graph.DefaultGraphBuilder.collectProjects (DefaultGraphBuilder.java:414)
at org.apache.maven.graph.DefaultGraphBuilder.getProjectsForMavenReactor (DefaultGraphBuilder.java:405)
at org.apache.maven.graph.DefaultGraphBuilder.build (DefaultGraphBuilder.java:82)
at org.apache.maven.DefaultMaven.buildGraph (DefaultMaven.java:507)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:219)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke (Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.