diff --git a/pom.xml b/pom.xml index a2dde74b..cb32c944 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,7 @@ under the License. ! The following property is used in the integration tests MCOMPILER-157 --> 3.5 - 2.9.0 + 2.9.1-SNAPSHOT 2.4.21 3.7.0 2.5.14-02 @@ -86,6 +86,19 @@ under the License. + + + plexus.snapshots + https://oss.sonatype.org/content/repositories/plexus-snapshots + + false + + + true + + + + diff --git a/src/it/default-fork-windows/invoker.properties b/src/it/default-fork-windows/invoker.properties new file mode 100644 index 00000000..b75cc35e --- /dev/null +++ b/src/it/default-fork-windows/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.os.family = windows diff --git a/src/it/default-fork-windows/pom.xml b/src/it/default-fork-windows/pom.xml new file mode 100644 index 00000000..ed149bf0 --- /dev/null +++ b/src/it/default-fork-windows/pom.xml @@ -0,0 +1,60 @@ + + + + + 4.0.0 + + org.apache.maven.plugins.compiler.it + default-fork + 1.0-SNAPSHOT + + Test for default configuration + + + UTF-8 + + + + + junit + junit + 3.8.2 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + @pom.version@ + + true + + -Xlint:-path + + + + + + + diff --git a/src/it/default-fork-windows/src/main/java/MyClass.java b/src/it/default-fork-windows/src/main/java/MyClass.java new file mode 100644 index 00000000..4945381a --- /dev/null +++ b/src/it/default-fork-windows/src/main/java/MyClass.java @@ -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. + */ + +public class MyClass +{ + +} diff --git a/src/it/default-fork-windows/src/test/java/MyTest.java b/src/it/default-fork-windows/src/test/java/MyTest.java new file mode 100644 index 00000000..46ba41d4 --- /dev/null +++ b/src/it/default-fork-windows/src/test/java/MyTest.java @@ -0,0 +1,26 @@ +/* + * 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 junit.framework.TestCase; + +public class MyTest + extends TestCase +{ + +} diff --git a/src/it/default-fork-windows/verify.groovy b/src/it/default-fork-windows/verify.groovy new file mode 100644 index 00000000..6b1651d7 --- /dev/null +++ b/src/it/default-fork-windows/verify.groovy @@ -0,0 +1,32 @@ +/* + * 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. + */ + +assert new File( basedir, 'target/classes/MyClass.class').exists() + +assert new File( basedir, 'target/test-classes/MyTest.class').exists() + +assert !new File( basedir, 'target/classes/javac.sh').exists() +assert !new File( basedir, 'target/classes/javac.bat').exists() + +assert !new File( basedir, 'target/javac.sh').exists() +assert !new File( basedir, 'target/javac-test.sh').exists() +assert new File( basedir, 'target/javac.bat').exists() +assert new File( basedir, 'target/javac-test.bat').exists() + + diff --git a/src/it/default-fork/invoker.properties b/src/it/default-fork/invoker.properties new file mode 100644 index 00000000..58909646 --- /dev/null +++ b/src/it/default-fork/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.os.family = !windows diff --git a/src/it/default-fork/pom.xml b/src/it/default-fork/pom.xml new file mode 100644 index 00000000..ed149bf0 --- /dev/null +++ b/src/it/default-fork/pom.xml @@ -0,0 +1,60 @@ + + + + + 4.0.0 + + org.apache.maven.plugins.compiler.it + default-fork + 1.0-SNAPSHOT + + Test for default configuration + + + UTF-8 + + + + + junit + junit + 3.8.2 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + @pom.version@ + + true + + -Xlint:-path + + + + + + + diff --git a/src/it/default-fork/src/main/java/MyClass.java b/src/it/default-fork/src/main/java/MyClass.java new file mode 100644 index 00000000..4945381a --- /dev/null +++ b/src/it/default-fork/src/main/java/MyClass.java @@ -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. + */ + +public class MyClass +{ + +} diff --git a/src/it/default-fork/src/test/java/MyTest.java b/src/it/default-fork/src/test/java/MyTest.java new file mode 100644 index 00000000..46ba41d4 --- /dev/null +++ b/src/it/default-fork/src/test/java/MyTest.java @@ -0,0 +1,26 @@ +/* + * 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 junit.framework.TestCase; + +public class MyTest + extends TestCase +{ + +} diff --git a/src/it/default-fork/verify.groovy b/src/it/default-fork/verify.groovy new file mode 100644 index 00000000..ba3bd7a2 --- /dev/null +++ b/src/it/default-fork/verify.groovy @@ -0,0 +1,33 @@ +/* + * 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. + */ + +assert new File( basedir, 'target/classes/MyClass.class').exists() + +assert new File( basedir, 'target/test-classes/MyTest.class').exists() + +assert !new File( basedir, 'target/classes/javac.sh').exists() +assert !new File( basedir, 'target/classes/javac.bat').exists() + +assert !new File( basedir, 'target/javac.bat').exists() +assert !new File( basedir, 'target/javac-test.bat').exists() + +assert new File( basedir, 'target/javac.sh').exists() +assert new File( basedir, 'target/javac-test.sh').exists() + + diff --git a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java index 7988a224..a027e550 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java +++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java @@ -590,6 +590,8 @@ public abstract class AbstractCompilerMojo protected abstract File getGeneratedSourcesDirectory(); + protected abstract String getDebugFileName(); + protected final MavenProject getProject() { return project; @@ -674,6 +676,8 @@ public void execute() compilerConfiguration.setDebug( debug ); + compilerConfiguration.setDebugFileName( getDebugFileName() ); + if ( debug && StringUtils.isNotEmpty( debuglevel ) ) { String[] split = StringUtils.split( debuglevel, "," ); 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 182ec438..8c5eee2f 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java +++ b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java @@ -129,6 +129,13 @@ public class CompilerMojo @Parameter private boolean multiReleaseOutput; + /** + * when forking and debug activated the commandline used will be dumped in this file + * @since 3.10.0 + */ + @Parameter( defaultValue = "javac" ) + private String debugFileName; + final LocationManager locationManager = new LocationManager(); private List classpathElements; @@ -425,6 +432,12 @@ protected File getGeneratedSourcesDirectory() return generatedSourcesDirectory; } + @Override + protected String getDebugFileName() + { + return debugFileName; + } + private void writeBoxedWarning( String message ) { String line = StringUtils.repeat( "*", message.length() + 4 ); @@ -432,4 +445,7 @@ private void writeBoxedWarning( String message ) getLog().warn( "* " + MessageUtils.buffer().strong( message ) + " *" ); getLog().warn( line ); } + + + } 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 b1c0b7ce..c352cf90 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java +++ b/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java @@ -156,6 +156,14 @@ public class TestCompilerMojo @Parameter( defaultValue = "${project.testClasspathElements}", readonly = true ) private List testPath; + + /** + * when forking and debug activated the commandline used will be dumped in this file + * @since 3.10.0 + */ + @Parameter( defaultValue = "javac-test" ) + private String debugFileName; + final LocationManager locationManager = new LocationManager(); private Map pathElements; @@ -477,6 +485,12 @@ protected File getGeneratedSourcesDirectory() return generatedTestSourcesDirectory; } + @Override + protected String getDebugFileName() + { + return debugFileName; + } + @Override protected boolean isTestCompile() {