commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1653895 - /commons/proper/commons-parent/trunk/pom.xml
Date Thu, 22 Jan 2015 15:04:53 GMT
Author: sebb
Date: Thu Jan 22 15:04:53 2015
New Revision: 1653895

URL: http://svn.apache.org/r1653895
Log:
Use simpler way of parsing the compiler target; also potentially more versatile

Modified:
    commons/proper/commons-parent/trunk/pom.xml

Modified: commons/proper/commons-parent/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/proper/commons-parent/trunk/pom.xml?rev=1653895&r1=1653894&r2=1653895&view=diff
==============================================================================
--- commons/proper/commons-parent/trunk/pom.xml (original)
+++ commons/proper/commons-parent/trunk/pom.xml Thu Jan 22 15:04:53 2015
@@ -763,46 +763,67 @@ Version 37:
 
   <profiles>
 
-      <!-- 
-           Runs the Animal Sniffer plugin to check that generated code does not included
references
-           to methods/classes etc that are not present in the standard Java runtime for the
defined target version.
-           To bypass the checks, define "animal.sniffer.skip" as true, or create the file
"src/site/resources/profile.noanimal" 
-      -->
-
       <profile>
-        <id>animal-sniffer</id>
+        <!--
+          Make the version parts of the maven.compiler.target property
+          available as separate properties, so that they can be used to define
+          the java signature artifactId used by animal-sniffer etc.
+        -->
+        <id>parse-target-version</id>
         <activation>
-          <!--  active unless the file is found -->
-          <file>
-            <missing>src/site/resources/profile.noanimal</missing>
-          </file>
+          <property>
+            <!--
+               This property should always be defined.
+               The intention is to ensure that the profile is always enabled.
+               (activeByDefault only applies if other profiles are not enabled) 
+            -->
+            <name>user.home</name>
+          </property>
         </activation>
-        
         <build>
           <plugins>
-            <!-- convert maven.compiler.target - e.g. 1.6 - to the sniffer signature -
e.g. java16 -->
             <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>build-helper-maven-plugin</artifactId>
-                <version>1.9.1</version>
               <executions>
                 <execution>
-                  <id>regex-property</id>
-                  <phase>validate</phase>
+                  <id>parse-version</id>
                   <goals>
-                    <goal>regex-property</goal>
+                    <goal>parse-version</goal>
                   </goals>
                   <configuration>
-                    <!-- generate the default animal sniffer java signature name from
the java target version -->
-                    <name>animal-sniffer.signature</name>
-                    <value>${maven.compiler.target}</value>
-                    <regex>^(\d)\.(\d)$</regex>
-                    <replacement>java$1$2</replacement>
-                    <failIfNoMatch>true</failIfNoMatch> <!-- unexpected compiler
version (assuming n.m version format)-->
+                    <propertyPrefix>javaTarget</propertyPrefix>
+                    <versionString>${maven.compiler.target}</versionString>
                   </configuration>
                 </execution>
               </executions>
             </plugin>
+          </plugins>
+        </build>
+      </profile>
+
+      <!-- 
+           Runs the Animal Sniffer plugin to check that generated code does not included
references
+           to methods/classes etc that are not present in the standard Java runtime for the
defined target version.
+           To bypass the checks, define "animal.sniffer.skip" as true, or create the file
"src/site/resources/profile.noanimal" 
+      -->
+
+      <profile>
+        <id>animal-sniffer</id>
+        <activation>
+          <!--  active unless the file is found -->
+          <file>
+            <missing>src/site/resources/profile.noanimal</missing>
+          </file>
+        </activation>
+        
+        <properties>
+          <!-- define this as a property to allow command-line override -->
+          <animal-sniffer.signature>java${javaTarget.majorVersion}${javaTarget.minorVersion}</animal-sniffer.signature>
+        </properties>
+
+        <build>
+          <plugins>
 
             <!-- Run the Animal Sniffer checks -->
             <plugin>



Mime
View raw message