You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2021/04/20 15:19:33 UTC
[maven-compiler-plugin] branch master updated: [MCOMPILER-373]
Unable to compile MR jar code against older directories
This is an automated email from the ASF dual-hosted git repository.
rfscholte 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 f17b9e2 [MCOMPILER-373] Unable to compile MR jar code against older directories
f17b9e2 is described below
commit f17b9e2d9d0c89b76fb5e8f980529534c0c109f6
Author: rfscholte <rf...@apache.org>
AuthorDate: Tue Apr 20 17:19:13 2021 +0200
[MCOMPILER-373] Unable to compile MR jar code against older directories
---
src/it/MCOMPILER-373_mrjar/invoker.properties | 18 ++++++
src/it/MCOMPILER-373_mrjar/pom.xml | 75 ++++++++++++++++++++++
.../src/main/java/org/maven/bug/A.java | 28 ++++++++
.../src/main/java/org/maven/bug/B.java | 28 ++++++++
.../src/main/java11/org/maven/bug/B.java | 28 ++++++++
.../src/main/java9/org/maven/bug/A9.java | 28 ++++++++
.../src/main/java9/org/maven/bug/B.java | 28 ++++++++
.../apache/maven/plugin/compiler/CompilerMojo.java | 6 +-
8 files changed, 238 insertions(+), 1 deletion(-)
diff --git a/src/it/MCOMPILER-373_mrjar/invoker.properties b/src/it/MCOMPILER-373_mrjar/invoker.properties
new file mode 100644
index 0000000..1c24cc3
--- /dev/null
+++ b/src/it/MCOMPILER-373_mrjar/invoker.properties
@@ -0,0 +1,18 @@
+# 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 = 11+
diff --git a/src/it/MCOMPILER-373_mrjar/pom.xml b/src/it/MCOMPILER-373_mrjar/pom.xml
new file mode 100644
index 0000000..e89f4f6
--- /dev/null
+++ b/src/it/MCOMPILER-373_mrjar/pom.xml
@@ -0,0 +1,75 @@
+<?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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.maven.bug</groupId>
+ <artifactId>mcompiler373</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>@project.version@</version>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ </configuration>
+ <!-- define the possible compilations -->
+ <executions>
+ <!-- for Java 9 -->
+ <execution>
+ <id>java9</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ <configuration>
+ <release>9</release>
+ <compileSourceRoots>
+ <compileSourceRoot>${project.basedir}/src/main/java9</compileSourceRoot>
+ </compileSourceRoots>
+ <multiReleaseOutput>true</multiReleaseOutput>
+ </configuration>
+ </execution>
+ <!-- for Java 11 -->
+ <execution>
+ <id>java11</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ <configuration>
+ <release>11</release>
+ <compileSourceRoots>
+ <compileSourceRoot>${project.basedir}/src/main/java11</compileSourceRoot>
+ </compileSourceRoots>
+ <multiReleaseOutput>true</multiReleaseOutput>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/src/it/MCOMPILER-373_mrjar/src/main/java/org/maven/bug/A.java b/src/it/MCOMPILER-373_mrjar/src/main/java/org/maven/bug/A.java
new file mode 100644
index 0000000..0330331
--- /dev/null
+++ b/src/it/MCOMPILER-373_mrjar/src/main/java/org/maven/bug/A.java
@@ -0,0 +1,28 @@
+package org.maven.bug;
+
+/*
+ * 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.
+ */
+
+public class A
+{
+ static int getCount()
+ {
+ return 1;
+ }
+}
diff --git a/src/it/MCOMPILER-373_mrjar/src/main/java/org/maven/bug/B.java b/src/it/MCOMPILER-373_mrjar/src/main/java/org/maven/bug/B.java
new file mode 100644
index 0000000..e30f729
--- /dev/null
+++ b/src/it/MCOMPILER-373_mrjar/src/main/java/org/maven/bug/B.java
@@ -0,0 +1,28 @@
+package org.maven.bug;
+
+/*
+ * 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.
+ */
+
+public class B
+{
+ static int getCount()
+ {
+ return A.getCount() + 1;
+ }
+}
diff --git a/src/it/MCOMPILER-373_mrjar/src/main/java11/org/maven/bug/B.java b/src/it/MCOMPILER-373_mrjar/src/main/java11/org/maven/bug/B.java
new file mode 100644
index 0000000..8963f31
--- /dev/null
+++ b/src/it/MCOMPILER-373_mrjar/src/main/java11/org/maven/bug/B.java
@@ -0,0 +1,28 @@
+package org.maven.bug;
+
+/*
+ * 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.
+ */
+
+public class B
+{
+ int getCount()
+ {
+ return A9.getCount() + 2;
+ }
+}
diff --git a/src/it/MCOMPILER-373_mrjar/src/main/java9/org/maven/bug/A9.java b/src/it/MCOMPILER-373_mrjar/src/main/java9/org/maven/bug/A9.java
new file mode 100644
index 0000000..16fcc26
--- /dev/null
+++ b/src/it/MCOMPILER-373_mrjar/src/main/java9/org/maven/bug/A9.java
@@ -0,0 +1,28 @@
+package org.maven.bug;
+
+/*
+ * 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.
+ */
+
+public class A9
+{
+ static int getCount()
+ {
+ return A.getCount() + 1;
+ }
+}
diff --git a/src/it/MCOMPILER-373_mrjar/src/main/java9/org/maven/bug/B.java b/src/it/MCOMPILER-373_mrjar/src/main/java9/org/maven/bug/B.java
new file mode 100644
index 0000000..cfb033b
--- /dev/null
+++ b/src/it/MCOMPILER-373_mrjar/src/main/java9/org/maven/bug/B.java
@@ -0,0 +1,28 @@
+package org.maven.bug;
+
+/*
+ * 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.
+ */
+
+public class B
+{
+ static int getCount()
+ {
+ return A9.getCount() + 1;
+ }
+}
diff --git a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
index 49a76c1..87f3bae 100644
--- a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java
@@ -290,7 +290,11 @@ public class CompilerMojo
}
else
{
- classpathElements = compilePath;
+ classpathElements = new ArrayList<>();
+ for ( File element : getCompileClasspathElements( getProject() ) )
+ {
+ classpathElements.add( element.getPath() );
+ }
modulepathElements = Collections.emptyList();
}
}