|
136 | 136 | <!-- Disable Maven Super POM release profile and instead use own one --> |
137 | 137 | <useReleaseProfile>false</useReleaseProfile> |
138 | 138 | <releaseProfiles>release</releaseProfiles> |
| 139 | + <!-- Run custom goals to replace version references, see plugin configuration below --> |
| 140 | + <!-- Also run `package`; otherwise goals fail for modules depending on each; possibly |
| 141 | + same issue as https://issues.apache.org/jira/browse/MRELEASE-271 --> |
| 142 | + <preparationGoals> |
| 143 | + package -DskipTests |
| 144 | + antrun:run@replace-version-placeholders |
| 145 | + antrun:run@replace-old-version-references |
| 146 | + antrun:run@git-add-changed |
| 147 | + </preparationGoals> |
139 | 148 | </configuration> |
140 | 149 | </plugin> |
| 150 | + <plugin> |
| 151 | + <artifactId>maven-antrun-plugin</artifactId> |
| 152 | + <version>3.1.0</version> |
| 153 | + <executions> |
| 154 | + <!-- Replaces version placeholders with the current version; this is mainly useful for |
| 155 | + Javadoc where this allows writing `@since $next-version$` --> |
| 156 | + <execution> |
| 157 | + <id>replace-version-placeholders</id> |
| 158 | + <goals> |
| 159 | + <goal>run</goal> |
| 160 | + </goals> |
| 161 | + <configuration> |
| 162 | + <target> |
| 163 | + <replace token="$next-version$" value="${project.version}" encoding="${project.build.sourceEncoding}"> |
| 164 | + <!-- erroronmissingdir=false for gson-parent which does not have source directory --> |
| 165 | + <fileset dir="${project.build.sourceDirectory}" includes="**" erroronmissingdir="false" /> |
| 166 | + </replace> |
| 167 | + </target> |
| 168 | + </configuration> |
| 169 | + </execution> |
| 170 | + <!-- Replaces references to the old version in the documentation --> |
| 171 | + <execution> |
| 172 | + <id>replace-old-version-references</id> |
| 173 | + <goals> |
| 174 | + <goal>run</goal> |
| 175 | + </goals> |
| 176 | + <configuration> |
| 177 | + <target> |
| 178 | + <!-- Replace Maven and Gradle version references; uses regex lookbehind and lookahead --> |
| 179 | + <replaceregexp match="(?<=<version>).*(?=</version>)|(?<='com\.google\.code\.gson:gson:).*(?=')" flags="g" replace="${project.version}" encoding="${project.build.sourceEncoding}"> |
| 180 | + <fileset dir="${project.basedir}"> |
| 181 | + <include name="README.md" /> |
| 182 | + <include name="UserGuide.md" /> |
| 183 | + </fileset> |
| 184 | + </replaceregexp> |
| 185 | + </target> |
| 186 | + </configuration> |
| 187 | + <!-- Only has to be executed for parent project; don't inherit this to modules --> |
| 188 | + <!-- This might be a bit hacky; execution with this ID seems to be missing for modules and Maven just executes default |
| 189 | + configuration which does not have any targets configured. (not sure if this behavior is guaranteed) --> |
| 190 | + <inherited>false</inherited> |
| 191 | + </execution> |
| 192 | + <!-- Adds changed files to the Git index; workaround because Maven Release Plugin does not support committing |
| 193 | + additional files yet (https://issues.apache.org/jira/browse/MRELEASE-798), and for workarounds with |
| 194 | + Maven SCM Plugin it is apparently necessary to know modified files in advance --> |
| 195 | + <!-- Maven Release Plugin then just happens to include these changed files in its Git commit; |
| 196 | + not sure if this behavior is guaranteed or if this relies on implementation details --> |
| 197 | + <execution> |
| 198 | + <id>git-add-changed</id> |
| 199 | + <goals> |
| 200 | + <goal>run</goal> |
| 201 | + </goals> |
| 202 | + <configuration> |
| 203 | + <target> |
| 204 | + <exec executable="git" dir="${project.basedir}" failonerror="true"> |
| 205 | + <arg value="add" /> |
| 206 | + <arg value="." /> |
| 207 | + </exec> |
| 208 | + </target> |
| 209 | + </configuration> |
| 210 | + </execution> |
| 211 | + </executions> |
| 212 | + </plugin> |
141 | 213 | <!-- Plugin for checking source and binary compatibility; used by GitHub workflow --> |
142 | 214 | <plugin> |
143 | 215 | <groupId>com.github.siom79.japicmp</groupId> |
|
0 commit comments