Skip to content

Commit 4c62b31

Browse files
authored
Apply enforcer plugin before others (#11)
so it can fail the build before deploying
1 parent cd426db commit 4c62b31

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

pom.xml

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,33 @@
127127
</execution>
128128
</executions>
129129
</plugin>
130+
<!-- Require profile `snapshot` or `release` when deploying.
131+
Having explicit profiles (instead of relying on deploy plugin's
132+
automatic snapshot/release routing) prevents the "on push"
133+
snapshot publish action from accidentally publishing a release version. -->
134+
<plugin>
135+
<groupId>org.apache.maven.plugins</groupId>
136+
<artifactId>maven-enforcer-plugin</artifactId>
137+
<executions>
138+
<execution>
139+
<id>enforce-deploy-has-active-profile</id>
140+
<phase>deploy</phase>
141+
<goals>
142+
<goal>enforce</goal>
143+
</goals>
144+
<configuration>
145+
<rules>
146+
<requireProfileIdsExist/>
147+
<requireActiveProfile>
148+
<profiles>snapshot,release</profiles>
149+
<all>false</all>
150+
</requireActiveProfile>
151+
</rules>
152+
<fail>true</fail>
153+
</configuration>
154+
</execution>
155+
</executions>
156+
</plugin>
130157
<plugin>
131158
<groupId>org.apache.maven.plugins</groupId>
132159
<artifactId>maven-gpg-plugin</artifactId>
@@ -178,33 +205,6 @@
178205
</execution>
179206
</executions>
180207
</plugin>
181-
<!-- Require profile `snapshot` or `release` when deploying.
182-
Having explicit profiles (instead of relying on deploy plugin's
183-
automatic snapshot/release routing) prevents the "on push"
184-
snapshot publish action from accidentally publishing a release version. -->
185-
<plugin>
186-
<groupId>org.apache.maven.plugins</groupId>
187-
<artifactId>maven-enforcer-plugin</artifactId>
188-
<executions>
189-
<execution>
190-
<id>enforce-deploy-has-active-profile</id>
191-
<phase>deploy</phase>
192-
<goals>
193-
<goal>enforce</goal>
194-
</goals>
195-
<configuration>
196-
<rules>
197-
<requireProfileIdsExist/>
198-
<requireActiveProfile>
199-
<profiles>snapshot,release</profiles>
200-
<all>false</all>
201-
</requireActiveProfile>
202-
</rules>
203-
<fail>true</fail>
204-
</configuration>
205-
</execution>
206-
</executions>
207-
</plugin>
208208
</plugins>
209209
</build>
210210

0 commit comments

Comments
 (0)