|
45 | 45 | <!--<git-commit-id-version>2.2.5</git-commit-id-version> -->
|
46 | 46 | <git-commit-id-version>3.0.0</git-commit-id-version>
|
47 | 47 | <sonar.projectVersion>${project.version}-${git.branch}</sonar.projectVersion>
|
| 48 | + <git-commit-plugin-prefix>git</git-commit-plugin-prefix> |
48 | 49 | </properties>
|
49 | 50 |
|
50 | 51 | <dependencies>
|
|
80 | 81 | </plugins>
|
81 | 82 | </build>
|
82 | 83 | <profiles>
|
| 84 | + <profile> |
| 85 | + <id>setup-git-prefix-for-submodule</id> |
| 86 | + <activation> |
| 87 | + <file> |
| 88 | + <exists>../pom.xml</exists> |
| 89 | + </file> |
| 90 | + </activation> |
| 91 | + <properties> |
| 92 | + <git-commit-plugin-prefix>git.${project.artifactId}</git-commit-plugin-prefix> |
| 93 | + </properties> |
| 94 | + </profile> |
| 95 | + <profile> |
| 96 | + <id>generate-git-props</id> |
| 97 | + <activation> |
| 98 | + <file> |
| 99 | + <exists>${basedir}/.git</exists> |
| 100 | + </file> |
| 101 | + </activation> |
| 102 | + <build> |
| 103 | + <plugins> |
| 104 | + <plugin> |
| 105 | + <groupId>pl.project13.maven</groupId> |
| 106 | + <artifactId>git-commit-id-plugin</artifactId> |
| 107 | + <version>${git-commit-id-version}</version> |
| 108 | + <executions> |
| 109 | + <execution> |
| 110 | + <id>get-the-git-infos</id> |
| 111 | + <goals> |
| 112 | + <goal>revision</goal> |
| 113 | + </goals> |
| 114 | + <phase>initialize</phase> |
| 115 | + </execution> |
| 116 | + <execution> |
| 117 | + <id>validate-the-git-infos</id> |
| 118 | + <goals> |
| 119 | + <goal>validateRevision</goal> |
| 120 | + </goals> |
| 121 | + <phase>compile</phase> |
| 122 | + </execution> |
| 123 | + </executions> |
| 124 | + <configuration> |
| 125 | + <prefix>${git-commit-plugin-prefix}</prefix> |
| 126 | + <!-- <prefix>git.${project.artifactId}</prefix> --> |
| 127 | + <skipPoms>false</skipPoms> |
| 128 | + <verbose>false</verbose> |
| 129 | + <dotGitDirectory>${project.basedir}/.git</dotGitDirectory> |
| 130 | + <injectAllReactorProjects>true</injectAllReactorProjects> |
| 131 | + <generateGitPropertiesFile>true</generateGitPropertiesFile> |
| 132 | + <generateGitPropertiesFilename>${project.build.outputDirectory}/${project.artifactId}_git.properties</generateGitPropertiesFilename> |
| 133 | + </configuration> |
| 134 | + </plugin> |
| 135 | + <plugin> |
| 136 | + <groupId>org.apache.maven.plugins</groupId> |
| 137 | + <artifactId>maven-antrun-plugin</artifactId> |
| 138 | + <version>1.8</version> |
| 139 | + <executions> |
| 140 | + <execution> |
| 141 | + <phase>package</phase> |
| 142 | + <configuration> |
| 143 | + <target> |
| 144 | + <echo>===========================================================================</echo> |
| 145 | + <echo>Found .git-Folder assuming we need to generate git.properties!</echo> |
| 146 | + <echo>Set prefix to: ${git-commit-plugin-prefix}</echo> |
| 147 | + <echo>Set dotGitDirectory to: ${project.basedir}/.git</echo> |
| 148 | + <echo>Set generateGitPropertiesFilename to: ${project.build.outputDirectory}/${project.artifactId}_git.properties</echo> |
| 149 | + </target> |
| 150 | + </configuration> |
| 151 | + <goals> |
| 152 | + <goal>run</goal> |
| 153 | + </goals> |
| 154 | + </execution> |
| 155 | + </executions> |
| 156 | + </plugin> |
| 157 | + <plugin> |
| 158 | + <groupId>org.codehaus.gmaven</groupId> |
| 159 | + <artifactId>gmaven-plugin</artifactId> |
| 160 | + <version>1.5</version> |
| 161 | + <executions> |
| 162 | + <execution> |
| 163 | + <id>out-put-dynamic-property</id> |
| 164 | + <phase>package</phase> |
| 165 | + <goals> |
| 166 | + <goal>execute</goal> |
| 167 | + </goals> |
| 168 | + <configuration> |
| 169 | + <source> |
| 170 | + String prefix = project.properties.getProperty("git-commit-plugin-prefix") |
| 171 | + System.out.println( |
| 172 | + "Commit-Generated for " + project.artifactId + " : " + |
| 173 | + project.properties.getProperty(prefix + ".commit.id") |
| 174 | + ) |
| 175 | + </source> |
| 176 | + </configuration> |
| 177 | + </execution> |
| 178 | + </executions> |
| 179 | + </plugin> |
| 180 | + </plugins> |
| 181 | + </build> |
| 182 | + </profile> |
83 | 183 | <profile>
|
84 | 184 | <id>git-with-parent</id>
|
85 | 185 | <build>
|
|
134 | 234 | <target>
|
135 | 235 | <echo>===========================================================================</echo>
|
136 | 236 | <echo>git.commit.id.describe: ${git.commit.id.describe}</echo>
|
| 237 | + <echo>git.commit.id.describe: ${git.commit.id.describe}</echo> |
137 | 238 | <echo>git.commit.id.describe.withoutdirty: ${git.commit.id.describe.withoutdirty}</echo>
|
138 | 239 | </target>
|
139 | 240 | </configuration>
|
|
0 commit comments