Skip to content

Commit 10c338f

Browse files
committed
only propagate git properties to other maven modules
1 parent 73147f7 commit 10c338f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/main/java/pl/project13/maven/git/GitCommitIdMojo.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public class GitCommitIdMojo extends AbstractMojo {
9999
* For details about why you might want to skip this, read this issue: https://github.com/ktoso/maven-git-commit-id-plugin/pull/65
100100
* Basically, injecting into all projects may slow down the build and you don't always need this feature.
101101
*
102-
* @parameter default-value="true"
102+
* @parameter default-value="false"
103103
*/
104104
@SuppressWarnings("UnusedDeclaration")
105105
private boolean injectAllReactorProjects;
@@ -359,7 +359,7 @@ public void execute() throws MojoExecutionException {
359359
}
360360

361361
if (injectAllReactorProjects) {
362-
appendPropertiesToReactorProjects(properties);
362+
appendPropertiesToReactorProjects(properties, prefixDot);
363363
}
364364
} catch (Exception e) {
365365
e.printStackTrace();
@@ -408,14 +408,16 @@ private void handlePluginFailure(Exception e) throws MojoExecutionException {
408408
}
409409
}
410410

411-
private void appendPropertiesToReactorProjects(@NotNull Properties properties) {
411+
private void appendPropertiesToReactorProjects(@NotNull Properties properties, @NotNull String trimmedPrefixWithDot) {
412412
for (MavenProject mavenProject : reactorProjects) {
413413
Properties mavenProperties = mavenProject.getProperties();
414414

415415
log(mavenProject.getName(), "] project", mavenProject.getName());
416416

417417
for (Object key : properties.keySet()) {
418-
mavenProperties.put(key, properties.get(key));
418+
if (key.toString().startsWith(trimmedPrefixWithDot)) {
419+
mavenProperties.put(key, properties.get(key));
420+
}
419421
}
420422
}
421423
}

0 commit comments

Comments
 (0)