Added: maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/pom.xml?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/pom.xml (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/pom.xml Thu Sep 7 18:51:21 2017 @@ -0,0 +1,65 @@ +<?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-non-default-config-headerfiles</artifactId> + <version>99.0</version> + <name>Maven</name> + <packaging>jmod</packaging> + <url>http://maven.apache.org</url> + <description>Test jmod file creation with include directory by using non default configuration.</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> + <configuration> + <headerFiles> + <headFile>src/main/non-headerfiles</headFile> + </headerFiles> + </configuration> + </plugin> + </plugins> + </build> +</project>
Added: maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/cmds/first.sh URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/cmds/first.sh?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/cmds/first.sh (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/cmds/first.sh Thu Sep 7 18:51:21 2017 @@ -0,0 +1 @@ +This first.sh should be located into bin directory into the resulting jmod file. \ No newline at end of file Added: maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/configs/config.test URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/configs/config.test?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/configs/config.test (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/configs/config.test Thu Sep 7 18:51:21 2017 @@ -0,0 +1,2 @@ +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/non-default-config-headerfiles/src/main/headerfiles/first.h URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/headerfiles/first.h?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/headerfiles/first.h (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/headerfiles/first.h Thu Sep 7 18:51:21 2017 @@ -0,0 +1,2 @@ +Test header file which should be located in include/first.h in +resulting jmod file. \ No newline at end of file Added: maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/java/module-info.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/java/module-info.java?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/java/module-info.java (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/java/module-info.java Thu Sep 7 18:51:21 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/non-default-config-headerfiles/src/main/java/myproject/HelloWorld.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/java/myproject/HelloWorld.java?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/java/myproject/HelloWorld.java (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/java/myproject/HelloWorld.java Thu Sep 7 18:51:21 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/non-default-config-headerfiles/src/main/non-headerfiles/non-first.h URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/non-headerfiles/non-first.h?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/non-headerfiles/non-first.h (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/src/main/non-headerfiles/non-first.h Thu Sep 7 18:51:21 2017 @@ -0,0 +1,2 @@ +Test header file which should be never located in include/first.h in +resulting jmod file based non default configuration. \ No newline at end of file Added: maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/verify.groovy URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/verify.groovy?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/verify.groovy (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-headerfiles/verify.groovy Thu Sep 7 18:51:21 2017 @@ -0,0 +1,88 @@ + +/* + * 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-non-default-config-headerfiles.jmod" ); + if ( !artifact.exists() || artifact.isDirectory() ) + { + System.err.println( "target file is missing or a directory." ); + return false; + } + + String[] artifactNames = [ + "include/non-first.h", + "bin/first.sh", + "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; + } + } + +} +catch( Throwable e ) +{ + e.printStackTrace(); + result = false; +} + +return result; Added: maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/invoker.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/invoker.properties?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/invoker.properties (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/invoker.properties Thu Sep 7 18:51:21 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/non-default-config-legalnotices/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/pom.xml?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/pom.xml (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/pom.xml Thu Sep 7 18:51:21 2017 @@ -0,0 +1,65 @@ +<?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-non-default-config-legalnotices</artifactId> + <version>99.0</version> + <name>Maven</name> + <packaging>jmod</packaging> + <url>http://maven.apache.org</url> + <description>Test jmod file creation with legal directory by using non default configuration.</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> + <configuration> + <legalNotices> + <legalNotice>src/main/non-legalnotices</legalNotice> + </legalNotices> + </configuration> + </plugin> + </plugins> + </build> +</project> Added: maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/src/main/java/module-info.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/src/main/java/module-info.java?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/src/main/java/module-info.java (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/src/main/java/module-info.java Thu Sep 7 18:51:21 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/non-default-config-legalnotices/src/main/java/myproject/HelloWorld.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/src/main/java/myproject/HelloWorld.java?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/src/main/java/myproject/HelloWorld.java (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/src/main/java/myproject/HelloWorld.java Thu Sep 7 18:51:21 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/non-default-config-legalnotices/src/main/legalnotices/first.md URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/src/main/legalnotices/first.md?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/src/main/legalnotices/first.md (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/src/main/legalnotices/first.md Thu Sep 7 18:51:21 2017 @@ -0,0 +1,2 @@ +Test legal notices file which will never be legal/first.md in +resulting jmod file based on the non default configuration. \ No newline at end of file Added: maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/src/main/non-legalnotices/non-first.md URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/src/main/non-legalnotices/non-first.md?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/src/main/non-legalnotices/non-first.md (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/src/main/non-legalnotices/non-first.md Thu Sep 7 18:51:21 2017 @@ -0,0 +1,2 @@ +Test legal notices file which will stay in legal/first.md in +resulting jmod file. \ No newline at end of file Added: maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/verify.groovy URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/verify.groovy?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/verify.groovy (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-legalnotices/verify.groovy Thu Sep 7 18:51:21 2017 @@ -0,0 +1,86 @@ + +/* + * 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-non-default-config-legalnotices.jmod" ); + if ( !artifact.exists() || artifact.isDirectory() ) + { + System.err.println( "target file is missing or a directory." ); + return false; + } + + String[] artifactNames = [ + "legal/non-first.md", + "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/non-default-config-libs/invoker.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/invoker.properties?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/invoker.properties (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/invoker.properties Thu Sep 7 18:51:21 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/non-default-config-libs/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/pom.xml?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/pom.xml (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/pom.xml Thu Sep 7 18:51:21 2017 @@ -0,0 +1,65 @@ +<?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-non-default-config-libs</artifactId> + <version>99.0</version> + <name>Maven</name> + <packaging>jmod</packaging> + <url>http://maven.apache.org</url> + <description>Test jmod file creation with libs directory by using non default configuration.</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> + <configuration> + <libs> + <lib>src/main/non-libs</lib> + </libs> + </configuration> + </plugin> + </plugins> + </build> +</project> Added: maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/src/main/java/module-info.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/src/main/java/module-info.java?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/src/main/java/module-info.java (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/src/main/java/module-info.java Thu Sep 7 18:51:21 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/non-default-config-libs/src/main/java/myproject/HelloWorld.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/src/main/java/myproject/HelloWorld.java?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/src/main/java/myproject/HelloWorld.java (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/src/main/java/myproject/HelloWorld.java Thu Sep 7 18:51:21 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/non-default-config-libs/src/main/libs/first.so URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/src/main/libs/first.so?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/src/main/libs/first.so (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/src/main/libs/first.so Thu Sep 7 18:51:21 2017 @@ -0,0 +1,2 @@ +Test native librariy file which will never stay lib/first.so in +resulting jmod file based on the non default configuration. \ No newline at end of file Added: maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/src/main/non-libs/non-first.so URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/src/main/non-libs/non-first.so?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/src/main/non-libs/non-first.so (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/src/main/non-libs/non-first.so Thu Sep 7 18:51:21 2017 @@ -0,0 +1,2 @@ +Test native librariy file which will stay in lib/non-first.so in +resulting jmod file. \ No newline at end of file Added: maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/verify.groovy URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/verify.groovy?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/verify.groovy (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config-libs/verify.groovy Thu Sep 7 18:51:21 2017 @@ -0,0 +1,86 @@ + +/* + * 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-non-default-config-libs.jmod" ); + if ( !artifact.exists() || artifact.isDirectory() ) + { + System.err.println( "target file is missing or a directory." ); + return false; + } + + String[] artifactNames = [ + "lib/non-first.so", + "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/non-default-config/invoker.properties URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/invoker.properties?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/invoker.properties (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/invoker.properties Thu Sep 7 18:51:21 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/non-default-config/pom.xml URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/pom.xml?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/pom.xml (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/pom.xml Thu Sep 7 18:51:21 2017 @@ -0,0 +1,66 @@ +<?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-non-default-config</artifactId> + <version>99.0</version> + <name>Maven</name> + <packaging>jmod</packaging> + <url>http://maven.apache.org</url> + <description>Test jmod file creation with config directory by using non default configuration.</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> + <configuration> + <configs> + <config>src/main/another-directory</config> + <config>src/main/another-sub-directory</config> + </configs> + </configuration> + </plugin> + </plugins> + </build> +</project> Added: maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/another-directory/config.test URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/another-directory/config.test?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/another-directory/config.test (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/another-directory/config.test Thu Sep 7 18:51:21 2017 @@ -0,0 +1,2 @@ +Test configuration file from another-directory 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/non-default-config/src/main/another-sub-directory/config-sub.test URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/another-sub-directory/config-sub.test?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/another-sub-directory/config-sub.test (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/another-sub-directory/config-sub.test Thu Sep 7 18:51:21 2017 @@ -0,0 +1,2 @@ +Test configuration file from another-sub-directory which should be located in config/config-sub.test in +resulting jmod file. \ No newline at end of file Added: maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/configs/default-config.test URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/configs/default-config.test?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/configs/default-config.test (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/configs/default-config.test Thu Sep 7 18:51:21 2017 @@ -0,0 +1,2 @@ +Test configuration file which should never be put into the config/config.test in +resulting jmod file based on the non default configuration. \ No newline at end of file Added: maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/java/module-info.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/java/module-info.java?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/java/module-info.java (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/java/module-info.java Thu Sep 7 18:51:21 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/non-default-config/src/main/java/myproject/HelloWorld.java URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/java/myproject/HelloWorld.java?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/java/myproject/HelloWorld.java (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/src/main/java/myproject/HelloWorld.java Thu Sep 7 18:51:21 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/non-default-config/verify.groovy URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/verify.groovy?rev=1807631&view=auto ============================================================================== --- maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/verify.groovy (added) +++ maven/plugins/trunk/maven-jmod-plugin/src/it/non-default-config/verify.groovy Thu Sep 7 18:51:21 2017 @@ -0,0 +1,87 @@ + +/* + * 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-non-default-config.jmod" ); + if ( !artifact.exists() || artifact.isDirectory() ) + { + System.err.println( "target file is missing or a directory." ); + return false; + } + + String[] artifactNames = [ + "conf/config.test", + "conf/config-sub.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; + } + } + +} +catch( Throwable e ) +{ + e.printStackTrace(); + result = false; +} + +return result;
