|
253 | 253 | <autoReleaseAfterClose>true</autoReleaseAfterClose> |
254 | 254 | </configuration> |
255 | 255 | </plugin> |
| 256 | + <plugin> |
| 257 | + <groupId>org.apache.maven.plugins</groupId> |
| 258 | + <artifactId>maven-enforcer-plugin</artifactId> |
| 259 | + <version>3.5.0</version> |
| 260 | + </plugin> |
256 | 261 | </plugins> |
257 | 262 | </pluginManagement> |
258 | 263 |
|
|
360 | 365 | <executable>java</executable> |
361 | 366 | </configuration> |
362 | 367 | </plugin> |
| 368 | + |
| 369 | + <!-- Require profile `snapshot` or `release` when deploying. |
| 370 | + Having explicit profiles (instead of relying on deploy plugin's |
| 371 | + automatic snapshot/release routing) prevents the "on push" |
| 372 | + snapshot publish action from accidentally publishing a release version. --> |
| 373 | + <plugin> |
| 374 | + <groupId>org.apache.maven.plugins</groupId> |
| 375 | + <artifactId>maven-enforcer-plugin</artifactId> |
| 376 | + <executions> |
| 377 | + <execution> |
| 378 | + <id>enforce-deploy-has-active-profile</id> |
| 379 | + <phase>deploy</phase> |
| 380 | + <goals> |
| 381 | + <goal>enforce</goal> |
| 382 | + </goals> |
| 383 | + <configuration> |
| 384 | + <rules> |
| 385 | + <requireProfileIdsExist/> |
| 386 | + <requireActiveProfile> |
| 387 | + <profiles>snapshot,release</profiles> |
| 388 | + <all>false</all> |
| 389 | + </requireActiveProfile> |
| 390 | + </rules> |
| 391 | + <fail>true</fail> |
| 392 | + </configuration> |
| 393 | + </execution> |
| 394 | + </executions> |
| 395 | + </plugin> |
363 | 396 | </plugins> |
364 | 397 | </build> |
365 | 398 |
|
|
416 | 449 | </execution> |
417 | 450 | </executions> |
418 | 451 | </plugin> |
| 452 | + <plugin> |
| 453 | + <groupId>org.apache.maven.plugins</groupId> |
| 454 | + <artifactId>maven-enforcer-plugin</artifactId> |
| 455 | + <executions> |
| 456 | + <execution> |
| 457 | + <id>enforce-release</id> |
| 458 | + <goals> |
| 459 | + <goal>enforce</goal> |
| 460 | + </goals> |
| 461 | + <configuration> |
| 462 | + <rules> |
| 463 | + <requireReleaseVersion> |
| 464 | + <message>Not a release version (remove -SNAPSHOT suffix!)</message> |
| 465 | + </requireReleaseVersion> |
| 466 | + <requireReleaseDeps> |
| 467 | + <message>Can't release with snapshot dependencies!</message> |
| 468 | + </requireReleaseDeps> |
| 469 | + </rules> |
| 470 | + <fail>true</fail> |
| 471 | + </configuration> |
| 472 | + </execution> |
| 473 | + </executions> |
| 474 | + </plugin> |
| 475 | + </plugins> |
| 476 | + </build> |
| 477 | + </profile> |
| 478 | + <profile> |
| 479 | + <id>snapshot</id> |
| 480 | + <build> |
| 481 | + <plugins> |
| 482 | + <plugin> |
| 483 | + <groupId>org.apache.maven.plugins</groupId> |
| 484 | + <artifactId>maven-enforcer-plugin</artifactId> |
| 485 | + <executions> |
| 486 | + <execution> |
| 487 | + <id>enforce-snapshot</id> |
| 488 | + <goals> |
| 489 | + <goal>enforce</goal> |
| 490 | + </goals> |
| 491 | + <configuration> |
| 492 | + <rules> |
| 493 | + <requireSnapshotVersion> |
| 494 | + <message>Not a SNAPSHOT version!</message> |
| 495 | + </requireSnapshotVersion> |
| 496 | + </rules> |
| 497 | + <fail>true</fail> |
| 498 | + </configuration> |
| 499 | + </execution> |
| 500 | + </executions> |
| 501 | + </plugin> |
419 | 502 | </plugins> |
420 | 503 | </build> |
421 | 504 | </profile> |
|
0 commit comments