Author: khmarbaise
Date: Wed Sep  6 21:39:54 2017
New Revision: 1807532

URL: http://svn.apache.org/viewvc?rev=1807532&view=rev
Log:
Added first integration test.

Added:
    maven/plugins/trunk/maven-jmod-plugin/README.md
    maven/plugins/trunk/maven-jmod-plugin/src/it/
    maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/
    maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/invoker.properties
    maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/pom.xml
    maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/src/
    maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/src/main/
    maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/src/main/java/
    
maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/src/main/java/module-info.java
    
maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/src/main/java/myproject/
    
maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/src/main/java/myproject/HelloWorld.java
    maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/verify.bsh
    maven/plugins/trunk/maven-jmod-plugin/src/it/settings.xml
Modified:
    maven/plugins/trunk/maven-jmod-plugin/pom.xml
    
maven/plugins/trunk/maven-jmod-plugin/src/main/filtered-resources/META-INF/plexus/components.xml

Added: maven/plugins/trunk/maven-jmod-plugin/README.md
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/README.md?rev=1807532&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/README.md (added)
+++ maven/plugins/trunk/maven-jmod-plugin/README.md Wed Sep  6 21:39:54 2017
@@ -0,0 +1,8 @@
+# How to run Integration Tests with JDK 9
+
+If you like to run the integration tests of the Maven JMod Plugin you have to 
start
+the Maven process like the following:
+```
+mvn clean verify -Prun-its -Dinvoker.javaHome=JDK9JAVAHOME
+```
+You have to give the home location for JDK 9 via parameter.

Modified: maven/plugins/trunk/maven-jmod-plugin/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/pom.xml?rev=1807532&r1=1807531&r2=1807532&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/pom.xml (original)
+++ maven/plugins/trunk/maven-jmod-plugin/pom.xml Wed Sep  6 21:39:54 2017
@@ -91,6 +91,27 @@
   </dependencies>
 
   <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>3.7.0</version>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.rat</groupId>
+          <artifactId>apache-rat-plugin</artifactId>
+          <configuration>
+            <excludes combine.children="append">
+              <!--
+                ! The module-info.java does not contain comments.
+              -->
+              <exclude>src/it/*/module-info.java</exclude>
+            </excludes>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
     <resources>
       <resource>
         <directory>src/main/filtered-resources</directory>
@@ -98,5 +119,37 @@
       </resource>
     </resources>
   </build>
+  <profiles>
+    <profile>
+      <id>run-its</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-invoker-plugin</artifactId>
+            <version>3.0.1</version>
+            <configuration>
+              <environmentVariables>
+                <MAVEN_SKIP_RC>1</MAVEN_SKIP_RC>
+              </environmentVariables>
+              <goals>
+                <goal>clean</goal>
+                <goal>package</goal>
+              </goals>
+            </configuration>
+            <executions>
+              <execution>
+                <id>integration-test</id>
+                <goals>
+                  <goal>install</goal>
+                  <goal>integration-test</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
 
 </project>

Added: maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/invoker.properties
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/invoker.properties?rev=1807532&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/invoker.properties 
(added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/invoker.properties Wed 
Sep  6 21:39:54 2017
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+invoker.goals = clean package

Added: maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/pom.xml?rev=1807532&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/pom.xml (added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/pom.xml Wed Sep  6 
21:39:54 2017
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";
+>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugins</groupId>
+  <artifactId>maven-jmod-plugin-test-project-001</artifactId>
+  <version>99.0</version>
+  <name>Maven</name>
+  <packaging>jmod</packaging>
+  <url>http://maven.apache.org</url>
+  <description>Test Base JMod creation</description>
+  <properties>
+    <maven.compiler.source>1.9</maven.compiler.source>
+    <maven.compiler.target>1.9</maven.compiler.target>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>3.7.0</version>
+          <configuration>
+            <target>1.9</target>
+            <source>1.9</source>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-jmod-plugin</artifactId>
+        <version>@project.version@</version>
+        <extensions>true</extensions>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: 
maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/src/main/java/module-info.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/src/main/java/module-info.java?rev=1807532&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/src/main/java/module-info.java
 (added)
+++ 
maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/src/main/java/module-info.java
 Wed Sep  6 21:39:54 2017
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+module org.apache.maven.plugins.jmod.it.first {
+  requires java.base;
+  exports myproject;
+}

Added: 
maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/src/main/java/myproject/HelloWorld.java
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/src/main/java/myproject/HelloWorld.java?rev=1807532&view=auto
==============================================================================
--- 
maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/src/main/java/myproject/HelloWorld.java
 (added)
+++ 
maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/src/main/java/myproject/HelloWorld.java
 Wed Sep  6 21:39:54 2017
@@ -0,0 +1,36 @@
+package myproject;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * The classic Hello World App.
+ */
+public class HelloWorld {
+
+  /**
+     * Main method.
+     *
+     * @param args Not used
+     */
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World from JDK 9" );
+    } 
+}
\ No newline at end of file

Added: maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/verify.bsh
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/verify.bsh?rev=1807532&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/verify.bsh (added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/base-it/verify.bsh Wed Sep  6 
21:39:54 2017
@@ -0,0 +1,85 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.*;
+import java.util.*;
+import java.util.jar.*;
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    File target = new File( basedir, "target" );
+    if ( !target.exists() || !target.isDirectory() )
+    {
+        System.err.println( "target file is missing or not a directory." );
+        return false;
+    }
+
+    File artifact = new File( target, 
"jmods/maven-jmod-plugin-test-project-001.jmod" );
+    if ( !artifact.exists() || artifact.isDirectory() )
+    {
+        System.err.println( "target file is missing or a directory." );
+        return false;
+    }
+
+    String[] artifactNames = new String[] { 
+      "classes/module-info.class",
+      "classes/myproject/HelloWorld.class",
+    };
+
+    Set contents = new HashSet();
+
+    JarFile jar = new JarFile( artifact );
+    Enumeration jarEntries = jar.entries();
+    while ( jarEntries.hasMoreElements() )
+    {
+        JarEntry entry = (JarEntry) jarEntries.nextElement();
+        if ( !entry.isDirectory() )
+        {
+            // Only compare files
+            contents.add( entry.getName() );
+        }
+    }
+
+    if  ( artifactNames.length != contents.size() )
+    {
+       System.err.println( "jar content size is different from the expected 
content size" );
+       return false;
+    }
+    for ( int i = 0; i < artifactNames.length; i++ )
+    {
+        String artifactName = artifactNames[i];
+               if ( !contents.contains( artifactName ) )
+               {
+               System.err.println( "Artifact[" + artifactName + "] not found 
in jar archive" );
+               return false;
+        }
+    }
+
+}
+catch( Throwable e )
+{
+    e.printStackTrace();
+    result = false;
+}
+
+return result;

Added: maven/plugins/trunk/maven-jmod-plugin/src/it/settings.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/settings.xml?rev=1807532&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/settings.xml (added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/settings.xml Wed Sep  6 
21:39:54 2017
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<settings>
+  <profiles>
+    <profile>
+      <id>it-repo</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <repositories>
+        <repository>
+          <id>local.central</id>
+          <url>@localRepositoryUrl@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </repository>
+      </repositories>
+      <pluginRepositories>
+        <pluginRepository>
+          <id>local.central</id>
+          <url>@localRepositoryUrl@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+    </profile>
+  </profiles>
+</settings>

Modified: 
maven/plugins/trunk/maven-jmod-plugin/src/main/filtered-resources/META-INF/plexus/components.xml
URL: 
http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/main/filtered-resources/META-INF/plexus/components.xml?rev=1807532&r1=1807531&r2=1807532&view=diff
==============================================================================
--- 
maven/plugins/trunk/maven-jmod-plugin/src/main/filtered-resources/META-INF/plexus/components.xml
 (original)
+++ 
maven/plugins/trunk/maven-jmod-plugin/src/main/filtered-resources/META-INF/plexus/components.xml
 Wed Sep  6 21:39:54 2017
@@ -58,13 +58,13 @@
                 org.apache.maven.plugins:maven-resources-plugin:3.0.2:resources
               </process-resources>
               <compile>
-                org.apache.maven.plugins:maven-compiler-plugin:3.6.2:compile
+                org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile
               </compile>
               <process-test-resources>
                 
org.apache.maven.plugins:maven-resources-plugin:3.0.2:testResources
               </process-test-resources>
               <test-compile>
-                
org.apache.maven.plugins:maven-compiler-plugin:3.6.2:testCompile
+                
org.apache.maven.plugins:maven-compiler-plugin:3.7.0:testCompile
               </test-compile>
               <test>
                 org.apache.maven.plugins:maven-surefire-plugin:2.20:test


Reply via email to