You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kh...@apache.org on 2017/09/17 10:53:08 UTC
svn commit: r1808613 - in /maven/plugins/trunk/maven-jmod-plugin/src:
it/describe-plain/ it/describe-plain/src/ it/describe-plain/src/main/
it/describe-plain/src/main/configs/ it/describe-plain/src/main/java/
it/describe-plain/src/main/java/myproject/ ...
Author: khmarbaise
Date: Sun Sep 17 10:53:07 2017
New Revision: 1808613
URL: http://svn.apache.org/viewvc?rev=1808613&view=rev
Log:
[MJMOD-5] Usage of moduleName in describe/list goal / classpath usage in create goal
o in describe/list goal change the moduleName into jmodFile using
a default or can be given explicit by a property.
Added IT's for direct call of the goals describe/list.
o Removed the parameter classPath from the goal create. The command line
will got the information from pathElements instead.
Added:
maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/
maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/invoker.properties
maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/pom.xml
maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/
maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/
maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/configs/
maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/configs/config.test
maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/java/
maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/java/module-info.java
maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/java/myproject/
maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/java/myproject/HelloWorld.java
maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/verify.groovy
maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/
maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/invoker.properties
maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/pom.xml
maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/
maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/
maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/configs/
maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/configs/config.test
maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/java/
maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/java/module-info.java
maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/java/myproject/
maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/java/myproject/HelloWorld.java
maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/verify.groovy
Modified:
maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModCreateMojo.java
maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModDescribeMojo.java
maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModListMojo.java
Added: maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/invoker.properties?rev=1808613&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/invoker.properties (added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/invoker.properties Sun Sep 17 10:53:07 2017
@@ -0,0 +1,19 @@
+# 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.java.version = 1.9+
+invoker.goals.1 = clean package
+invoker.goals.2 = ${project.groupId}:${project.artifactId}:${project.version}:describe -Djmodfile=target/jmods/maven-jmod-plugin-describe-base-config.jmod
Added: maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/pom.xml?rev=1808613&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/pom.xml (added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/pom.xml Sun Sep 17 10:53:07 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-describe-base-config</artifactId>
+ <version>99.0</version>
+ <name>Maven</name>
+ <packaging>jmod</packaging>
+ <url>http://maven.apache.org</url>
+ <description>Test jmod describe to get the output</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/describe-plain/src/main/configs/config.test
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/configs/config.test?rev=1808613&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/configs/config.test (added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/configs/config.test Sun Sep 17 10:53:07 2017
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+Test configuration file which should be located in config/config.test in
+resulting jmod file.
\ No newline at end of file
Added: maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/java/module-info.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/java/module-info.java?rev=1808613&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/java/module-info.java (added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/java/module-info.java Sun Sep 17 10:53:07 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/describe-plain/src/main/java/myproject/HelloWorld.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/java/myproject/HelloWorld.java?rev=1808613&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/java/myproject/HelloWorld.java (added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/src/main/java/myproject/HelloWorld.java Sun Sep 17 10:53:07 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/describe-plain/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/verify.groovy?rev=1808613&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/verify.groovy (added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/describe-plain/verify.groovy Sun Sep 17 10:53:07 2017
@@ -0,0 +1,89 @@
+
+/*
+ * 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 directory is missing or not a directory." );
+ return false;
+ }
+
+ File artifact = new File( target, "jmods/maven-jmod-plugin-describe-base-config.jmod" );
+ if ( !artifact.exists() || artifact.isDirectory() ) {
+ System.err.println( "the resulting jmod file is missing or a directory." );
+ return false;
+ }
+
+ String[] artifactNames = [
+ "conf/config.test",
+ "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;
+ }
+ }
+
+ def buildLog = new File (basedir, "build.log")
+
+ if (!buildLog.text.contains("[INFO] org.apache.maven.plugins.jmod.it.first@99.0")) {
+ return false;
+ }
+ if (!buildLog.text.contains("[INFO] exports myproject")) {
+ return false;
+ }
+ if (!buildLog.text.contains("[INFO] requires java.base")) {
+ return false;
+ }
+}
+catch( Throwable e ) {
+ e.printStackTrace();
+ result = false;
+}
+
+return result;
Added: maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/invoker.properties?rev=1808613&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/invoker.properties (added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/invoker.properties Sun Sep 17 10:53:07 2017
@@ -0,0 +1,19 @@
+# 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.java.version = 1.9+
+invoker.goals = clean package
+invoker.goals.2 = ${project.groupId}:${project.artifactId}:${project.version}:list -Djmodfile=target/jmods/maven-jmod-plugin-list-base-config.jmod
\ No newline at end of file
Added: maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/pom.xml?rev=1808613&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/pom.xml (added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/pom.xml Sun Sep 17 10:53:07 2017
@@ -0,0 +1,69 @@
+<?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-list-base-config</artifactId>
+ <version>99.0</version>
+ <name>Maven</name>
+ <packaging>jmod</packaging>
+ <url>http://maven.apache.org</url>
+ <description>Test jmod list to get the output</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>
+ <executions>
+ <execution>
+ <id>describe-jmod</id>
+ <goals>
+ <goal>list</goal>
+ </goals>
+ <phase>package</phase>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Added: maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/configs/config.test
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/configs/config.test?rev=1808613&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/configs/config.test (added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/configs/config.test Sun Sep 17 10:53:07 2017
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+Test configuration file which should be located in config/config.test in
+resulting jmod file.
\ No newline at end of file
Added: maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/java/module-info.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/java/module-info.java?rev=1808613&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/java/module-info.java (added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/java/module-info.java Sun Sep 17 10:53:07 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/list-plain/src/main/java/myproject/HelloWorld.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/java/myproject/HelloWorld.java?rev=1808613&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/java/myproject/HelloWorld.java (added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/src/main/java/myproject/HelloWorld.java Sun Sep 17 10:53:07 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/list-plain/verify.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/verify.groovy?rev=1808613&view=auto
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/verify.groovy (added)
+++ maven/plugins/trunk/maven-jmod-plugin/src/it/list-plain/verify.groovy Sun Sep 17 10:53:07 2017
@@ -0,0 +1,89 @@
+
+/*
+ * 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 directory is missing or not a directory." );
+ return false;
+ }
+
+ File artifact = new File( target, "jmods/maven-jmod-plugin-list-base-config.jmod" );
+ if ( !artifact.exists() || artifact.isDirectory() ) {
+ System.err.println( "the resulting jmod file is missing or a directory." );
+ return false;
+ }
+
+ String[] artifactNames = [
+ "conf/config.test",
+ "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;
+ }
+ }
+
+ def buildLog = new File (basedir, "build.log")
+
+ if (!buildLog.text.contains("[INFO] classes/module-info.class")) {
+ return false;
+ }
+ if (!buildLog.text.contains("[INFO] classes/myproject/HelloWorld.class")) {
+ return false;
+ }
+ if (!buildLog.text.contains("[INFO] conf/config.test")) {
+ return false;
+ }
+}
+catch( Throwable e ) {
+ e.printStackTrace();
+ result = false;
+}
+
+return result;
Modified: maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModCreateMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModCreateMojo.java?rev=1808613&r1=1808612&r2=1808613&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModCreateMojo.java (original)
+++ maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModCreateMojo.java Sun Sep 17 10:53:07 2017
@@ -79,13 +79,6 @@ public class JModCreateMojo
private LocationManager locationManager;
/**
- * <code>--class-path <path></code> Application jar files/directory containing classes. Specifies a class path
- * whose content will be copied into the resulting <code>jmod</code> file.
- */
- @Parameter( defaultValue = "${project.build.outputDirectory}" )
- private List<String> classPath;
-
- /**
* Specifies one or more directories containing native commands to be copied. The given directories are relative to
* the current base directory. If no entry is defined the default is <code>src/main/cmds</code> used.
*
@@ -310,10 +303,6 @@ public class JModCreateMojo
getLog().debug( "Parent: " + jModExecutableParent.getAbsolutePath() );
getLog().debug( "jmodsFolder: " + jmodsFolderJDK.getAbsolutePath() );
- /*
- * this.moduleName = extract module name from module-info.java if not defined extract the package name as
- * default
- */
preparePaths();
failIfParametersAreNotInTheirValidValueRanges();
@@ -394,13 +383,6 @@ public class JModCreateMojo
private void failIfParametersAreNotInTheirValidValueRanges()
throws MojoFailureException
{
- // if ( moduleName == null || ( moduleName != null && moduleName.trim().isEmpty() ) )
- // {
- // String message = "A moduleName must be given.";
- // getLog().error( message );
- // throw new MojoFailureException( message );
- // }
-
if ( warnIfResolved != null )
{
String x = warnIfResolved.toLowerCase().trim();
@@ -505,6 +487,7 @@ public class JModCreateMojo
for ( Map.Entry<File, ModuleNameSource> entry : resolvePathsResult.getModulepathElements().entrySet() )
{
+ getLog().debug( "File: " + entry.getKey().getAbsolutePath() + " " + entry.getValue().name() );
if ( ModuleNameSource.FILENAME.equals( entry.getValue() ) )
{
final String message = "Required filename-based automodules detected. "
@@ -526,16 +509,19 @@ public class JModCreateMojo
for ( Map.Entry<File, JavaModuleDescriptor> entry : resolvePathsResult.getPathElements().entrySet() )
{
+ getLog().debug( "pathElements: " + entry.getKey().getPath() + " " + entry.getValue().name() );
pathElements.put( entry.getKey().getPath(), entry.getValue() );
}
for ( File file : resolvePathsResult.getClasspathElements() )
{
+ getLog().debug( "classpathElements: File: " + file.getPath() );
classpathElements.add( file.getPath() );
}
for ( File file : resolvePathsResult.getModulepathElements().keySet() )
{
+ getLog().debug( "modulepathElements: File: " + file.getPath() );
modulepathElements.add( file.getPath() );
}
}
@@ -573,10 +559,17 @@ public class JModCreateMojo
argsFile.println( moduleVersion );
}
- if ( classPath != null )
+ if ( !pathElements.isEmpty() )
{
argsFile.println( "--class-path" );
- argsFile.println( getPlatformSeparatedList( classPath ) );
+ //TODO: Can't this be achieved in a more elegant way?
+ // the classpathElements do not contain the needed information?
+ ArrayList<String> x = new ArrayList<>();
+ for ( String string : pathElements.keySet() )
+ {
+ x.add( string );
+ }
+ argsFile.println( getPlatformSeparatedList( x ) );
}
if ( excludes != null && !excludes.isEmpty() )
Modified: maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModDescribeMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModDescribeMojo.java?rev=1808613&r1=1808612&r2=1808613&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModDescribeMojo.java (original)
+++ maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModDescribeMojo.java Sun Sep 17 10:53:07 2017
@@ -45,10 +45,16 @@ public class JModDescribeMojo
private File outputDirectory;
/**
- * The moduleName. The default is to use the <code>artifactId</code>.
+ * The name of the jmod file which is used to be examined via <code>jmod describe jmodFile</code>
*/
- @Parameter( defaultValue = "${project.artifactId}", required = true )
- private String moduleName;
+ //@formatter:off
+ @Parameter(
+ defaultValue = "${project.build.directory}/jmods/${project.artifactId}.jmod",
+ property = "jmodfile",
+ required = true
+ )
+ //@formatter:on
+ private File jmodFile;
public void execute()
throws MojoExecutionException, MojoFailureException
@@ -66,20 +72,15 @@ public class JModDescribeMojo
getLog().info( "Toolchain in maven-jmod-plugin: jmod [ " + jModExecutable + " ]" );
- // TODO: Need to think about if we really require to have the jmod
- // file being located in the target directory?
- File modsFolder = new File( outputDirectory, "jmods" );
- File resultingJModFile = new File( modsFolder, moduleName + ".jmod" );
-
- if ( !resultingJModFile.exists() || !resultingJModFile.isFile() )
+ if ( !jmodFile.exists() || !jmodFile.isFile() )
{
- throw new MojoFailureException( "Unable to find " + resultingJModFile.getAbsolutePath() );
+ throw new MojoFailureException( "Unable to find " + jmodFile.getAbsolutePath() );
}
Commandline cmd;
try
{
- cmd = createJModDescribeCommandLine( resultingJModFile );
+ cmd = createJModDescribeCommandLine( jmodFile );
}
catch ( IOException e )
{
@@ -87,8 +88,7 @@ public class JModDescribeMojo
}
cmd.setExecutable( jModExecutable );
- getLog().info( "The following information is contained in the module file "
- + resultingJModFile.getAbsolutePath() );
+ getLog().info( "The following information is contained in the module file " + jmodFile.getAbsolutePath() );
executeCommand( cmd, outputDirectory );
}
Modified: maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModListMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModListMojo.java?rev=1808613&r1=1808612&r2=1808613&view=diff
==============================================================================
--- maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModListMojo.java (original)
+++ maven/plugins/trunk/maven-jmod-plugin/src/main/java/org/apache/maven/plugins/jmod/JModListMojo.java Sun Sep 17 10:53:07 2017
@@ -45,10 +45,16 @@ public class JModListMojo
private File outputDirectory;
/**
- * The moduleName. The default is to use the <code>artifactId</code>.
+ * The name of the jmod file which is used to be examined via <code>jmod list jmodFile</code>
*/
- @Parameter( defaultValue = "${project.artifactId}", required = true )
- private String moduleName;
+ //@formatter:off
+ @Parameter(
+ defaultValue = "${project.build.directory}/jmods/${project.artifactId}.jmod",
+ property = "jmodfile",
+ required = true
+ )
+ //@formatter:on
+ private File jmodFile;
public void execute()
throws MojoExecutionException, MojoFailureException
@@ -66,21 +72,15 @@ public class JModListMojo
getLog().info( "Toolchain in maven-jmod-plugin: jmod [ " + jModExecutable + " ]" );
- // We need to put the resulting x.jmod files into jmods folder otherwise is
- // seemed to be not working.
- // Check why?
- File modsFolder = new File( outputDirectory, "jmods" );
- File resultingJModFile = new File( modsFolder, moduleName + ".jmod" );
-
- if ( !resultingJModFile.exists() || !resultingJModFile.isFile() )
+ if ( !jmodFile.exists() || !jmodFile.isFile() )
{
- throw new MojoFailureException( "Unable to find " + resultingJModFile.getAbsolutePath() );
+ throw new MojoFailureException( "Unable to find " + jmodFile.getAbsolutePath() );
}
Commandline cmd;
try
{
- cmd = createJModListCommandLine( resultingJModFile );
+ cmd = createJModListCommandLine( jmodFile );
}
catch ( IOException e )
{
@@ -88,7 +88,7 @@ public class JModListMojo
}
cmd.setExecutable( jModExecutable );
- getLog().info( "The following files are contained in the module file " + resultingJModFile.getAbsolutePath() );
+ getLog().info( "The following files are contained in the module file " + jmodFile.getAbsolutePath() );
executeCommand( cmd, outputDirectory );
}