@@ -81,7 +81,7 @@ Projects wishing to use pom-scijava as a parent project need to override the <
8181 </contributors >
8282
8383 <prerequisites >
84- <maven >3.0.4 </maven >
84+ <maven >${scijava.mvn.version} </maven >
8585 </prerequisites >
8686
8787 <scm >
@@ -218,6 +218,9 @@ Projects wishing to use pom-scijava as a parent project need to override the <
218218
219219 <!-- NB: Override argLineDebug property via debug-port profile. -->
220220 <argLineDebug />
221+
222+ <scijava .jvm.version>1.6</scijava .jvm.version>
223+ <scijava .mvn.version>3.0.4</scijava .mvn.version>
221224 </properties >
222225
223226 <dependencyManagement >
@@ -512,8 +515,8 @@ Projects wishing to use pom-scijava as a parent project need to override the <
512515 <version >3.1</version >
513516 <!-- Require the Java 6 platform. -->
514517 <configuration >
515- <source >1.6 </source >
516- <target >1.6 </target >
518+ <source >${scijava.jvm.version} </source >
519+ <target >${scijava.jvm.version} </target >
517520 </configuration >
518521 </plugin >
519522
@@ -527,6 +530,18 @@ Projects wishing to use pom-scijava as a parent project need to override the <
527530 <version >2.8.1</version >
528531 </plugin >
529532
533+ <plugin >
534+ <artifactId >maven-enforcer-plugin</artifactId >
535+ <version >1.3.1</version >
536+ <dependencies >
537+ <dependency >
538+ <groupId >org.codehaus.mojo</groupId >
539+ <artifactId >extra-enforcer-rules</artifactId >
540+ <version >1.0-beta-3</version >
541+ </dependency >
542+ </dependencies >
543+ </plugin >
544+
530545 <plugin >
531546 <artifactId >maven-install-plugin</artifactId >
532547 <version >2.5.1</version >
@@ -812,6 +827,28 @@ Projects wishing to use pom-scijava as a parent project need to override the <
812827 <artifactId >maven-surefire-plugin</artifactId >
813828 </plugin >
814829
830+ <!-- Check desired rules during maven lifecycle. -->
831+ <plugin >
832+ <artifactId >maven-enforcer-plugin</artifactId >
833+ <executions >
834+ <execution >
835+ <id >enforce-rules</id >
836+ <phase >validate</phase >
837+ <goals >
838+ <goal >enforce</goal >
839+ </goals >
840+ </execution >
841+ </executions >
842+ <configuration >
843+ <rules >
844+ <enforceBytecodeVersion >
845+ <maxJdkVersion >${scijava.jvm.version} </maxJdkVersion >
846+ </enforceBytecodeVersion >
847+ <banCircularDependencies />
848+ </rules >
849+ </configuration >
850+ </plugin >
851+
815852 <!-- Add Implementation-Build entry to JAR manifest. -->
816853 <plugin >
817854 <groupId >org.codehaus.mojo</groupId >
@@ -903,6 +940,43 @@ Projects wishing to use pom-scijava as a parent project need to override the <
903940 </reporting >
904941
905942 <profiles >
943+ <!-- This profile contains maven-enforcer rules that we may want to disable
944+ in some cases (such as when intentionally building with SNAPSHOT
945+ dependencies). Disable it with: -Dscijava.enforce.skip -->
946+ <profile >
947+ <id >scijava.enforcer.rules</id >
948+ <activation >
949+ <property >
950+ <name >!scijava.enforce.skip</name >
951+ </property >
952+ </activation >
953+
954+ <build >
955+ <plugins >
956+ <plugin >
957+ <artifactId >maven-enforcer-plugin</artifactId >
958+ <configuration >
959+ <rules >
960+ <banDuplicateClasses >
961+ <message >No Duplicate Classes Allowed!</message >
962+ </banDuplicateClasses >
963+ <requireMavenVersion >
964+ <version >${scijava.mvn.version} </version >
965+ </requireMavenVersion >
966+ <requirePluginVersions >
967+ <message >Plugins need to be versioned!</message >
968+ </requirePluginVersions >
969+ <requirePrerequisites />
970+ <requireReleaseDeps >
971+ <message >No Snapshots Allowed!</message >
972+ </requireReleaseDeps >
973+ </rules >
974+ </configuration >
975+ </plugin >
976+ </plugins >
977+ </build >
978+ </profile >
979+
906980 <!-- These developer profiles make it easy to pin to SNAPSHOT versions.
907981 Add an empty dev.<organization> file in your ~/.scijava directory, and
908982 dependencies will automatically update! You may also need to refresh
0 commit comments