Skip to content

Commit

Permalink
#90 Support for JPMS module path for exec:java (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfscholte authored Feb 18, 2019
1 parent 8c8162d commit dd95d38
Show file tree
Hide file tree
Showing 27 changed files with 616 additions and 73 deletions.
66 changes: 64 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
Expand All @@ -203,7 +208,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.4</version>
<version>3.6.0</version>
<configuration>
<goalPrefix>exec</goalPrefix>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
Expand All @@ -215,6 +220,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.17</version>
<executions>
<execution>
<goals>
Expand All @@ -236,7 +242,7 @@
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
<version>1.7</version>
<version>2.0.0</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -292,6 +298,7 @@
<addTestClassPath>true</addTestClassPath>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<projectsDirectory>src/it/projects</projectsDirectory>
<showErrors>true</showErrors>
<showVersion>true</showVersion>
<preBuildHookScript>setup</preBuildHookScript>
<postBuildHookScript>verify</postBuildHookScript>
Expand Down Expand Up @@ -339,5 +346,60 @@
</plugins>
</build>
</profile>
<profile>
<id>jdk9</id>
<activation>
<jdk>[9,)</jdk>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<executions>
<execution>
<id>jdk9</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<release>9</release>
<multiReleaseOutput>true</multiReleaseOutput>
<compileSourceRoots>
<compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>
</compileSourceRoots>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<configuration>
<archive>
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
</project>
2 changes: 2 additions & 0 deletions src/it/mrm/java_module/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
invoker.goals = compile exec:java
invoker.java.version = 9+
44 changes: 44 additions & 0 deletions src/it/mrm/java_module/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.codehaus.mojo.exec.it</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
</parent>

<artifactId>jigsaw</artifactId>
<version>0.0.1-SNAPSHOT</version>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>9</source>
<target>9</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<mainClass>com.greetings/com.greetings.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</project>
6 changes: 6 additions & 0 deletions src/it/mrm/java_module/src/main/java/com/greetings/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.greetings;
public class Main {
public static void main(String[] args) {
System.out.println("Greetings!");
}
}
1 change: 1 addition & 0 deletions src/it/mrm/java_module/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module com.greetings { }
2 changes: 2 additions & 0 deletions src/it/projects/java_module-export/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
invoker.goals = compile exec:java
invoker.java.version = 9+
43 changes: 43 additions & 0 deletions src/it/projects/java_module-export/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.codehaus.mojo.exec.it</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
</parent>

<artifactId>jigsaw</artifactId>
<version>0.0.1-SNAPSHOT</version>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>9</release>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<mainClass>com.greetings.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.greetings;

public class Main
{
public static void main( String[] args )
{
System.out.println( org.codehaus.plexus.util.StringUtils.swapCase( "Greetings!" ) );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module com.greetings {
exports com.greetings;

requires plexus.utils;
}
21 changes: 21 additions & 0 deletions src/it/projects/java_module-export/verify.groovy
Original file line number Diff line number Diff line change
@@ -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.
*/
File log = new File(basedir, 'build.log')
assert log.exists()
assert log.getText().contains( "gREETINGS!")
2 changes: 2 additions & 0 deletions src/it/projects/java_module-mainclass/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
invoker.goals = compile exec:java
invoker.java.version = 9+
43 changes: 43 additions & 0 deletions src/it/projects/java_module-mainclass/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.codehaus.mojo.exec.it</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
</parent>

<artifactId>jigsaw</artifactId>
<version>0.0.1-SNAPSHOT</version>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>9</release>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<mainClass>com.greetings.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.greetings;

public class Main
{
public static void main( String[] args )
{
System.out.println( org.codehaus.plexus.util.StringUtils.swapCase( "Greetings!" ) );
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module com.greetings {
requires plexus.utils;
}
21 changes: 21 additions & 0 deletions src/it/projects/java_module-mainclass/verify.groovy
Original file line number Diff line number Diff line change
@@ -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.
*/
File log = new File(basedir, 'build.log')
assert log.exists()
assert log.getText().contains( "gREETINGS!")
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
invoker.goals = compile exec:java
invoker.java.version = 9+
44 changes: 44 additions & 0 deletions src/it/projects/java_module-module+mainclass/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.codehaus.mojo.exec.it</groupId>
<artifactId>parent</artifactId>
<version>0.1</version>
</parent>

<artifactId>jigsaw</artifactId>
<version>0.0.1-SNAPSHOT</version>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>9</source>
<target>9</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>@project.version@</version>
<configuration>
<mainClass>com.greetings/com.greetings.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</project>
Loading

0 comments on commit dd95d38

Please sign in to comment.