diff --git a/.gitignore b/.gitignore
index b57c544..49745f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,5 @@ target
.idea
.classpath
.project
-.settings
\ No newline at end of file
+.settings
+/.git-versioned-pom.xml
diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml
new file mode 100644
index 0000000..0140c38
--- /dev/null
+++ b/.mvn/extensions.xml
@@ -0,0 +1,7 @@
+
+
+ me.qoomon
+ maven-git-versioning-extension
+ 9.6.5
+
+
diff --git a/.mvn/maven-git-versioning-extension.xml b/.mvn/maven-git-versioning-extension.xml
new file mode 100644
index 0000000..4559a39
--- /dev/null
+++ b/.mvn/maven-git-versioning-extension.xml
@@ -0,0 +1,22 @@
+
+
+ [
+ .+
+
+ ${version}
+ ]
+
+ [
+ \d+\.\d+\.\d+.*)$]]>
+ ${ref.version}
+ ]
+
+
+
+
+ ${commit}
+
+
diff --git a/pom.xml b/pom.xml
index f49fafb..a0bfb83 100644
--- a/pom.xml
+++ b/pom.xml
@@ -46,6 +46,10 @@
+
+
+ ${git.commit.timestamp.datetime}
+
UTF-8
UTF-8
@@ -123,6 +127,30 @@
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.3.0
+
+
+
+ true
+ true
+ true
+
+
+
+ ${git.commit}
+
+ ${git.commit.timestamp.datetime}
+
+ ${project.version}-${git.commit}
+ ${java.version}
+ ${java.vendor}
+
+
+
+
diff --git a/src/main/java/com/github/johnpoth/jshell/JShellMojo.java b/src/main/java/com/github/johnpoth/jshell/JShellMojo.java
index 16cdedd..73c146f 100644
--- a/src/main/java/com/github/johnpoth/jshell/JShellMojo.java
+++ b/src/main/java/com/github/johnpoth/jshell/JShellMojo.java
@@ -5,9 +5,9 @@
* 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
- *
+ *
+ * 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.
@@ -16,6 +16,14 @@
*/
package com.github.johnpoth.jshell;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.plugins.annotations.ResolutionScope;
+
import javax.tools.Tool;
import java.io.File;
import java.nio.file.Files;
@@ -26,18 +34,12 @@
import java.util.Optional;
import java.util.ServiceLoader;
import java.util.stream.Collectors;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugins.annotations.LifecyclePhase;
-import org.apache.maven.plugins.annotations.Mojo;
-import org.apache.maven.plugins.annotations.Parameter;
-import org.apache.maven.plugins.annotations.ResolutionScope;
+import static java.util.Optional.ofNullable;
-@Mojo( name = "run", defaultPhase = LifecyclePhase.INSTALL, requiresDependencyResolution = ResolutionScope.TEST, requiresDependencyCollection = ResolutionScope.TEST )
-public class JShellMojo extends AbstractMojo
-{
+
+@Mojo(name = "run", defaultPhase = LifecyclePhase.INSTALL, requiresDependencyResolution = ResolutionScope.TEST, requiresDependencyCollection = ResolutionScope.TEST)
+public class JShellMojo extends AbstractMojo {
@Parameter(defaultValue = "${project.runtimeClasspathElements}", property = "rcp", required = true)
private List runtimeClasspathElements;
@@ -121,12 +123,15 @@ private List filterClasspath(List cp) {
return cp.stream()
.filter(s -> {
Path path = Paths.get(s);
- if (Files.notExists(path)){
- getLog().warn("Removing: " + s +" from the classpath." + System.lineSeparator() +
- "If this is unexpected, please make sure you correctly build the project beforehand by invoking the correct Maven build phase (usually `install`, `test-compile` or `compile`). For example:" + System.lineSeparator() +
- "mvn test-compile com.github.johnpoth:jshell-maven-plugin:1.3:run" + System.lineSeparator() +
- "For more information visit https://github.com/johnpoth/jshell-maven-plugin"
- );
+ if (Files.notExists(path)) {
+ getLog().info(String.format(
+ "Removing: %s from the classpath.%n" +
+ "If this is unexpected, please make sure you correctly build the project beforehand by invoking the correct Maven build phase (usually `install`, `test-compile` or `compile`). For example:%n" +
+ "mvn test-compile com.github.johnpoth:jshell-maven-plugin:%s:run%n" +
+ "For more information visit https://github.com/johnpoth/jshell-maven-plugin",
+ s,
+ ofNullable(this.getClass().getPackage().getImplementationVersion()).orElse("RELEASE")
+ ));
return false;
}
if (Files.isDirectory(path)) {
@@ -135,7 +140,9 @@ private List filterClasspath(List cp) {
if (s.endsWith(".jar")) {
return true;
}
- getLog().debug("Removing: " + s +" from the classpath because it is unsupported in JShell.");
+ if (getLog().isDebugEnabled()) {
+ getLog().debug("Removing: " + s + " from the classpath because it is unsupported in JShell.");
+ }
return false;
}).collect(Collectors.toList());
}
@@ -145,19 +152,19 @@ private String[] addArguments(String cp) {
if (useProjectClasspath) {
args.add("--class-path");
args.add(cp);
- } else if (classpath != null ){
+ } else if (classpath != null) {
args.add("--class-path");
args.add(classpath);
}
- if (modulepath != null){
+ if (modulepath != null) {
args.add("--module-path");
args.add(modulepath);
}
- if (addModules!= null){
+ if (addModules != null) {
args.add("--add-modules");
args.add(addModules);
}
- if (addExports!= null){
+ if (addExports != null) {
args.add("--add-exports");
args.add(addExports);
}