-
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
Can't use generated properties when building maven #601
Comments
Mhh tested this locally and the plugin is generating the property For debugging I'd suggest to add I'd almost guess that the project where the plugin is running is pom project (
Here is what I tested for reference: <plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
<version>5.0.0</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
<phase>initialize</phase>
</execution>
</executions>
<configuration>
<verbose>true</verbose>
<skipPoms>false</skipPoms>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
<includeOnlyProperties>
<includeOnlyProperty>^git.branch.*$</includeOnlyProperty>
</includeOnlyProperties>
<injectAllReactorProjects>true</injectAllReactorProjects>
<replacementProperties>
<replacementProperty>
<property>git.branch</property>
<propertyOutputSuffix>version</propertyOutputSuffix>
<token>^(feature/.+|dev)$</token>
<value>dev</value>
</replacementProperty>
</replacementProperties>
</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>===========================================================================</echo>
<echo>git.branch.version: ${git.branch.version}</echo>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin> generates
|
Thanks for your response, the property is generated as expected, but can't be used in project and dependencies' version.
<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>test.group</groupId>
<artifactId>test2</artifactId>
<version>${revision}-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<dependency.version>${git.branch.version}-SNAPSHOT</dependency.version>
<revision>${git.branch.version}</revision>
</properties>
<dependencies>
<dependency>
<groupId>test.group</groupId>
<artifactId>test1</artifactId>
<version>${dependency.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>io.github.git-commit-id</groupId>
<artifactId>git-commit-id-maven-plugin</artifactId>
<version>5.0.0</version>
<executions>
<execution>
<id>get-the-git-infos</id>
<goals>
<goal>revision</goal>
</goals>
<phase>initialize</phase>
</execution>
</executions>
<configuration>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
<includeOnlyProperties>
<includeOnlyProperty>^git.branch.*$</includeOnlyProperty>
</includeOnlyProperties>
<forceValueEvaluation>true</forceValueEvaluation>
<injectIntoSysProperties>true</injectIntoSysProperties>
<replacementProperties>
<replacementProperty>
<property>git.branch</property>
<propertyOutputSuffix>version</propertyOutputSuffix>
<token>^(feature/.+|dev)$</token>
<value>dev</value>
</replacementProperty>
<replacementProperty>
<property>git.branch</property>
<propertyOutputSuffix>version</propertyOutputSuffix>
<token>master</token>
<value>uat</value>
<regex>false</regex>
</replacementProperty>
</replacementProperties>
</configuration>
</plugin>
</plugins>
</build>
</project> |
This is unsupported: Attempt to use the workarounds suggested, or solutions like generating the pom on the fly with the flatten-maven-plugin. See also #256 (comment) et. al. |
The properties generated by this plugin can't be used directly as those declared in
<properties>
.Steps to Reproduce
Expected behavior
The text was updated successfully, but these errors were encountered: