You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sj...@apache.org on 2022/12/08 08:58:03 UTC

[maven-compiler-plugin] branch master updated: [MCOMPILER-512] - Defining maven.compiler.release as empty string end with NumberFormatException (#158)

This is an automated email from the ASF dual-hosted git repository.

sjaranowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-compiler-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 752a1fa  [MCOMPILER-512] - Defining maven.compiler.release as empty string end with NumberFormatException (#158)
752a1fa is described below

commit 752a1fa09751bb8e5de44a58d8063bf8001715e6
Author: project25o1 <ma...@holger-mense.de>
AuthorDate: Thu Dec 8 09:57:58 2022 +0100

    [MCOMPILER-512] - Defining maven.compiler.release as empty string end with NumberFormatException (#158)
---
 src/it/MCOMPILER-512/invoker.properties            | 20 ++++++++++
 src/it/MCOMPILER-512/pom.xml                       | 46 ++++++++++++++++++++++
 src/it/MCOMPILER-512/src/main/java/dummy/Main.java | 32 +++++++++++++++
 src/it/MCOMPILER-512/src/test/java/dummy/Test.java | 30 ++++++++++++++
 .../maven/plugin/compiler/TestCompilerMojo.java    |  5 ++-
 5 files changed, 131 insertions(+), 2 deletions(-)

diff --git a/src/it/MCOMPILER-512/invoker.properties b/src/it/MCOMPILER-512/invoker.properties
new file mode 100644
index 0000000..9bcebc2
--- /dev/null
+++ b/src/it/MCOMPILER-512/invoker.properties
@@ -0,0 +1,20 @@
+# 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 test
+invoker.buildResult = success
+invoker.java.version = 9+
\ No newline at end of file
diff --git a/src/it/MCOMPILER-512/pom.xml b/src/it/MCOMPILER-512/pom.xml
new file mode 100644
index 0000000..5e15953
--- /dev/null
+++ b/src/it/MCOMPILER-512/pom.xml
@@ -0,0 +1,46 @@
+<!--
+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/xsd/maven-4.0.0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins</groupId>
+  <artifactId>maven-compiler-plugin-MCOMPILER512</artifactId>
+  <version>1.0.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+	<maven.compiler.release></maven.compiler.release>
+  </properties>
+  
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>@pom.version@</version>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/MCOMPILER-512/src/main/java/dummy/Main.java b/src/it/MCOMPILER-512/src/main/java/dummy/Main.java
new file mode 100644
index 0000000..7b36fb7
--- /dev/null
+++ b/src/it/MCOMPILER-512/src/main/java/dummy/Main.java
@@ -0,0 +1,32 @@
+package dummy;
+
+/*
+ * 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 javax.smartcardio.TerminalFactory;
+
+public class Main
+{
+
+    public static void main(String[] args)
+    {
+        TerminalFactory tf =  TerminalFactory.getDefault();
+    }
+
+}
diff --git a/src/it/MCOMPILER-512/src/test/java/dummy/Test.java b/src/it/MCOMPILER-512/src/test/java/dummy/Test.java
new file mode 100644
index 0000000..a0cc02c
--- /dev/null
+++ b/src/it/MCOMPILER-512/src/test/java/dummy/Test.java
@@ -0,0 +1,30 @@
+package dummy;
+
+/*
+ * 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 javax.smartcardio.TerminalFactory;
+
+public class Test
+{
+    public void test()
+    {
+        TerminalFactory tf =  TerminalFactory.getDefault();
+    }
+}
diff --git a/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
index ed855ab..1c854fa 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java
@@ -38,6 +38,7 @@ 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 org.apache.maven.shared.utils.StringUtils;
 import org.apache.maven.toolchain.Toolchain;
 import org.apache.maven.toolchain.java.DefaultJavaToolChain;
 import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner;
@@ -311,9 +312,9 @@ public class TestCompilerMojo
             testModuleDescriptor = result.getMainModuleDescriptor();
         }
 
-        if ( release != null )
+        if ( StringUtils.isNotEmpty( getRelease() ) )
         {
-            if ( Integer.parseInt( release ) < 9 )
+            if ( Integer.parseInt( getRelease() ) < 9 )
             {
                 pathElements = Collections.emptyMap();
                 modulepathElements = Collections.emptyList();