-
Notifications
You must be signed in to change notification settings - Fork 301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to generate git.properties file AND add properties to maven project properties #391
Comments
Hi, Full example: <plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.5</version>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<prefix>git</prefix>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<injectAllReactorProjects>true</injectAllReactorProjects>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>package</phase>
<configuration>
<target>
<echo>Git-Infos: ${git.commit.id}</echo>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins> |
Thank you for your reply! I didn't tried this parameter before. After I read the documentation I thought it is not appropriate in my case because I don't have any reactor projects (git submodules) in my project. In the description of parameter it's said that:
but I just want these properties to inject into my project along with generating file, but not injecting it into any other reactor projects. Setting |
Mhh I think there might be a bit of a confusion about the different terms. Let me try to clarify what the In general a maven project can consist either of a single pom, or a multi project build. The multi project build is usually called a When you set Gitmodules on the other hand is a slightly different concept and you can find more information under https://git-scm.com/book/en/v2/Git-Tools-Submodules. Gitmodules is the concept where you have a git project and need another git project within (maybe some shared code or configuration settings for your IDE). Using git submodules is independent to using a If I understand it correctly you want to be able to get the properties of your normal git project and the git properties of your git submodule and expose them both as git properties and to the maven project. If this is the case I would say that's the same problem as running the plugin multiple times with different git projects (technically I consider a git submodule a different git since it would result in different properties). In such a case please checkout my answer in #137 (comment) where I outline how one could run the plugin multiple times with different git projects without overwriting already generated properties. Please note that in your case you might want to extend this configuration with Hope this helps. Please feel free to let me know if you need further help :-) |
Ohh and before I forget to mention...if you experience that this plugin might run slow, I would recommend to checkout and play around with the To use the native git (might make the build faster) set |
Hi, |
Now everything's clear to me. Thanks for help! My problem is solved now and this issue could be closed I suppose. |
I would like if plugin allow me to generate git.properties file along with adding properties to maven project properties. Currently there is only boolean parameter
generateGitPropertiesFile
which allow to generate file OR to add properties to maven properties, but in my project it is necessary to do both of these things.I suggest to add a new boolean parameter
addToMavenProperties
which enables/disables adding properties to maven properties. Then it should be checked that at least one of this two parameters is true.The text was updated successfully, but these errors were encountered: