diff --git a/.asf.yaml b/.asf.yaml index 3da1b9d9..8f576f26 100644 --- a/.asf.yaml +++ b/.asf.yaml @@ -23,14 +23,3 @@ github: - build-management - maven-plugins - maven - enabled_merge_buttons: - squash: true - merge: false - rebase: true - autolink_jira: - - MCOMPILER -notifications: - commits: commits@maven.apache.org - issues: issues@maven.apache.org - pullrequests: issues@maven.apache.org - jira_options: link label comment diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs deleted file mode 100644 index 25f76f2c..00000000 --- a/.git-blame-ignore-revs +++ /dev/null @@ -1,21 +0,0 @@ -# -# 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. -# - -# Change maven code style -f7a4613eaa2364dcaf10f96f04a6b1afb2feb7ed diff --git a/.github/workflows/maven-verify.yml b/.github/workflows/maven-verify.yml index cce83592..103392ea 100644 --- a/.github/workflows/maven-verify.yml +++ b/.github/workflows/maven-verify.yml @@ -24,14 +24,10 @@ on: jobs: build: name: Verify - uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v4 + uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v3 with: # maven-args: "-Dinvoker.parallelThreads=2" cannot do this as this generate some concurrent download issues jdk-distribution-matrix: '[ "temurin", "zulu", "microsoft", "adopt-openj9" ]' - jdk-matrix: '[ "8", "11", "17", "21" ]' - matrix-exclude: '[ - { "jdk": "8", "distribution": "microsoft" }, - { "jdk": "8", "distribution": "temurin", "os": "macos-latest" }, - { "jdk": "8", "distribution": "adopt-openj9", "os": "macos-latest" } - ]' - maven-matrix: '[ "3.6.3", "3.8.8", "3.9.6" ]' # Maven versions matrix for verify builds + jdk-matrix: '[ "8", "11", "17", "18" ]' # "19-ea" + matrix-exclude: '[{ "jdk": "8", "distribution": "microsoft"},{ "jdk": "19-ea", "distribution": "microsoft"},{ "jdk": "18", "distribution": "microsoft"},{ "jdk": "19-ea", "distribution": "adopt-openj9"},]' + maven-matrix: '[ "3.3.9", "3.6.3", "3.8.6" ]' # Maven versions matrix for verify builds diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index 1049eaa3..58e5ee49 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -22,4 +22,4 @@ on: - master jobs: update_release_draft: - uses: apache/maven-gh-actions-shared/.github/workflows/release-drafter.yml@v4 + uses: apache/maven-gh-actions-shared/.github/workflows/release-drafter.yml@v2 diff --git a/README.md b/README.md index 251bb18e..7ea92537 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,6 @@ Contributing to [Apache Maven Compiler Plugin](https://maven.apache.org/plugins/ [![ASF Jira](https://img.shields.io/endpoint?url=https%3A%2F%2Fmaven.apache.org%2Fbadges%2Fasf_jira-MCOMPILER.json)][jira] [![Apache License, Version 2.0, January 2004](https://img.shields.io/github/license/apache/maven.svg?label=License)][license] [![Maven Central](https://img.shields.io/maven-central/v/org.apache.maven.plugins/maven-compiler-plugin.svg?label=Maven%20Central)](https://search.maven.org/artifact/org.apache.maven.plugins/maven-compiler-plugin) -[![Reproducible Builds](https://img.shields.io/badge/Reproducible_Builds-ok-green?labelColor=blue)](https://github.com/jvm-repo-rebuild/reproducible-central/blob/master/content/org/apache/maven/plugins/maven-compiler-plugin/README.md) [![Jenkins Status](https://img.shields.io/jenkins/s/https/ci-maven.apache.org/job/Maven/job/maven-box/job/maven-compiler-plugin/job/master.svg?)][build] [![Jenkins tests](https://img.shields.io/jenkins/t/https/ci-maven.apache.org/job/Maven/job/maven-box/job/maven-compiler-plugin/job/master.svg?)][test-results] diff --git a/pom.xml b/pom.xml index 5a83a207..aa902b06 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ under the License. maven-compiler-plugin - 3.13.1-SNAPSHOT + 4.0.0-SNAPSHOT maven-plugin Apache Maven Compiler Plugin @@ -67,48 +67,73 @@ under the License. - 3.6.3 - 2.15.0 + 4.0.0-beta-3 + + 4.0.0-SNAPSHOT + 2.12.1 2.4.21 3.7.0 2.5.14-02 - 1.2.0 - 8 + 1.1.1 + 4.0.1 + 17 + 5.10.1 + 4.11.0 false - 2024-03-15T07:28:09Z + 3.2.1 + 4.0.0-alpha-3-SNAPSHOT + 2022-03-08T01:04:02Z org.apache.maven.plugins.compiler.its + + + + + com.thoughtworks.qdox + qdox + 2.0.1 + + + org.junit + junit-bom + ${junitVersion} + pom + import + + + org.mockito + mockito-bom + ${mockitoVersion} + pom + import + + + + - - org.apache.maven.plugin-tools - maven-plugin-annotations - provided - org.apache.maven - maven-plugin-api + maven-api-core ${mavenVersion} provided - org.apache.maven - maven-artifact - ${mavenVersion} - provided + org.slf4j + slf4j-api + 1.7.36 - org.apache.maven - maven-core - ${mavenVersion} - provided + org.codehaus.plexus + plexus-utils - org.apache.maven.shared - maven-shared-utils - 3.4.2 + org.codehaus.plexus + plexus-xml org.apache.maven.shared @@ -127,12 +152,18 @@ under the License. org.apache.maven.shared maven-shared-utils - - org.codehaus.plexus - plexus-component-annotations - + + org.apache.maven.shared + maven-shared-utils + 3.4.2 + + + org.eclipse.sisu + org.eclipse.sisu.plexus + 0.9.0.M2 + org.codehaus.plexus @@ -144,51 +175,74 @@ under the License. org.codehaus.plexus plexus-compiler-api ${plexusCompilerVersion} + + + org.codehaus.plexus + plexus-component-api + + org.codehaus.plexus plexus-compiler-manager ${plexusCompilerVersion} + + + org.codehaus.plexus + plexus-component-api + + org.codehaus.plexus plexus-compiler-javac ${plexusCompilerVersion} - runtime + + + org.codehaus.plexus + plexus-component-api + + + - org.codehaus.plexus - plexus-utils + org.apache.maven + maven-core + ${mavenVersion} + test - - org.apache.maven.plugin-testing - maven-plugin-testing-harness - 4.0.0-alpha-2 + org.apache.maven + maven-model-builder + ${mavenVersion} test - - org.codehaus.plexus - plexus-xml + org.apache.maven + maven-xml-impl + ${mavenVersion} + test + + + org.apache.maven.plugin-testing + maven-plugin-testing-harness + ${mavenPluginTestingHarnessVersion} test org.mockito mockito-core - 4.8.0 test org.junit.jupiter - junit-jupiter-api - 5.10.2 + junit-jupiter test - org.junit.jupiter - junit-jupiter-params - 5.10.2 + org.slf4j + slf4j-simple + 2.0.13 test @@ -210,23 +264,84 @@ under the License. - com.diffplug.spotless - spotless-maven-plugin + org.apache.rat + apache-rat-plugin + + + .java-version + + + + + maven-enforcer-plugin + + + enforce-bytecode-version + + + + ${javaVersion} + + org.ow2.asm:asm + + + + + + + + + + org.apache.maven.plugins + maven-invoker-plugin + 3.6.0 + + + org.apache.maven.plugins + maven-jxr-plugin + 3.2.0 + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.4.0 - - - src/**/*.java - - + + + + org.apache.maven.plugins + maven-release-plugin + 3.0.1 + - - org.eclipse.sisu - sisu-maven-plugin + org.apache.maven.plugins + maven-plugin-plugin + ${mavenPluginPluginVersion} + + + org.codehaus.plexus + plexus-component-metadata + 2.1.1 + + + descriptors + + generate-metadata + + + + + + org.apache.maven.plugins + maven-surefire-plugin + + **/*$*, unit/** + @@ -244,6 +359,9 @@ under the License. integration-test + + true + true src/it ${project.build.directory}/it @@ -257,13 +375,22 @@ under the License. ! https://issues.apache.org/jira/browse/MINVOKER-174 --> - setup*/pom.xml + setup_jar_module/pom.xml + setup_jar_automodule/pom.xml + setup_x/pom.xml + + setup_x/** + verify ${project.build.directory}/local-repo src/it/settings.xml ${maven.it.failure.ignore} true + + + ${https.protocols} + clean test-compile diff --git a/src/it/MCOMPILER-129/src/main/java/MyClass.java b/src/it/MCOMPILER-129/src/main/java/MyClass.java index d4132bb2..80144b07 100644 --- a/src/it/MCOMPILER-129/src/main/java/MyClass.java +++ b/src/it/MCOMPILER-129/src/main/java/MyClass.java @@ -1,21 +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. - */ -package foo; - -public class MyClass {} +/* + * 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/MCOMPILER-157/annotation-processor/src/main/java/org/issue/SimpleAnnotation.java b/src/it/MCOMPILER-157/annotation-processor/src/main/java/org/issue/SimpleAnnotation.java index 5339365e..ccae1639 100644 --- a/src/it/MCOMPILER-157/annotation-processor/src/main/java/org/issue/SimpleAnnotation.java +++ b/src/it/MCOMPILER-157/annotation-processor/src/main/java/org/issue/SimpleAnnotation.java @@ -1,3 +1,5 @@ +package org.issue; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package org.issue; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; @@ -25,4 +26,6 @@ @Target(ElementType.TYPE) @Retention(RetentionPolicy.SOURCE) -public @interface SimpleAnnotation {} +public @interface SimpleAnnotation { + +} diff --git a/src/it/MCOMPILER-157/annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java b/src/it/MCOMPILER-157/annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java index b95f3e22..30823a1d 100644 --- a/src/it/MCOMPILER-157/annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java +++ b/src/it/MCOMPILER-157/annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java @@ -1,3 +1,5 @@ +package org.issue; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,10 @@ * specific language governing permissions and limitations * under the License. */ -package org.issue; + +import java.io.IOException; +import java.io.Writer; +import java.util.Set; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.Filer; @@ -32,39 +37,44 @@ import javax.tools.FileObject; import javax.tools.StandardLocation; -import java.io.IOException; -import java.io.Writer; -import java.util.Set; - -@SupportedSourceVersion(SourceVersion.RELEASE_6) -@SupportedAnnotationTypes("org.issue.SimpleAnnotation") -public class SimpleAnnotationProcessor extends AbstractProcessor { +@SupportedSourceVersion( SourceVersion.RELEASE_6 ) +@SupportedAnnotationTypes( "org.issue.SimpleAnnotation" ) +public class SimpleAnnotationProcessor + extends AbstractProcessor +{ @Override - public boolean process(Set annotations, RoundEnvironment roundEnv) { + public boolean process( Set annotations, RoundEnvironment roundEnv ) + { Filer filer = processingEnv.getFiler(); Elements elementUtils = processingEnv.getElementUtils(); - Set elements = roundEnv.getElementsAnnotatedWith(SimpleAnnotation.class); + Set elements = roundEnv.getElementsAnnotatedWith( SimpleAnnotation.class ); - for (Element element : elements) { + for ( Element element : elements ) + { Name name = element.getSimpleName(); - PackageElement packageElement = elementUtils.getPackageOf(element); + PackageElement packageElement = elementUtils.getPackageOf( element ); - try { - FileObject resource = filer.createResource( - StandardLocation.SOURCE_OUTPUT, packageElement.getQualifiedName(), name + ".txt", element); + try + { + FileObject resource = + filer.createResource( StandardLocation.SOURCE_OUTPUT, packageElement.getQualifiedName(), name + + ".txt", element ); Writer writer = resource.openWriter(); - writer.write(name.toString()); + writer.write( name.toString() ); writer.close(); - } catch (IOException e) { - throw new RuntimeException(e); + } + catch ( IOException e ) + { + throw new RuntimeException( e ); } } return !elements.isEmpty(); } + } diff --git a/src/it/MCOMPILER-157/annotation-user/pom.xml b/src/it/MCOMPILER-157/annotation-user/pom.xml index 9d304fea..69066f74 100644 --- a/src/it/MCOMPILER-157/annotation-user/pom.xml +++ b/src/it/MCOMPILER-157/annotation-user/pom.xml @@ -58,9 +58,9 @@ under the License. - org.apache.maven.plugins.compiler.it - annotation-verify-plugin - 1.0.0-SNAPSHOT + org.issue + annotation-verify + 1.0-SNAPSHOT verify-annotations diff --git a/src/it/MCOMPILER-157/annotation-user/src/main/java/org/issue/SimpleObject.java b/src/it/MCOMPILER-157/annotation-user/src/main/java/org/issue/SimpleObject.java index 18b8fc43..56524fb8 100644 --- a/src/it/MCOMPILER-157/annotation-user/src/main/java/org/issue/SimpleObject.java +++ b/src/it/MCOMPILER-157/annotation-user/src/main/java/org/issue/SimpleObject.java @@ -1,3 +1,5 @@ +package org.issue; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.issue; @SimpleAnnotation -public class SimpleObject {} +public class SimpleObject +{ + +} diff --git a/src/it/MCOMPILER-157/annotation-user/src/test/java/org/issue/SimpleTestObject.java b/src/it/MCOMPILER-157/annotation-user/src/test/java/org/issue/SimpleTestObject.java index 706dccf1..9024f6a3 100644 --- a/src/it/MCOMPILER-157/annotation-user/src/test/java/org/issue/SimpleTestObject.java +++ b/src/it/MCOMPILER-157/annotation-user/src/test/java/org/issue/SimpleTestObject.java @@ -1,3 +1,5 @@ +package org.issue; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.issue; @SimpleAnnotation -public class SimpleTestObject {} +public class SimpleTestObject +{ + +} diff --git a/src/it/MCOMPILER-157/annotation-verify/pom.xml b/src/it/MCOMPILER-157/annotation-verify/pom.xml new file mode 100644 index 00000000..a69507e7 --- /dev/null +++ b/src/it/MCOMPILER-157/annotation-verify/pom.xml @@ -0,0 +1,76 @@ + + + + + + 4.0.0 + + + org.issue + compiler-test + 1.0-SNAPSHOT + + + annotation-verify + maven-plugin + + + + org.issue + annotation-processor + 1.0-SNAPSHOT + + + + org.apache.maven + maven-api-core + @mavenVersion@ + + + org.apache.maven.shared + maven-shared-utils + 3.3.3 + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + @mavenPluginPluginVersion@ + + foo + true + + + + mojo-descriptor + process-classes + + descriptor + + + + + + + \ No newline at end of file diff --git a/src/it/MCOMPILER-157/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java b/src/it/MCOMPILER-157/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java new file mode 100644 index 00000000..6032c6eb --- /dev/null +++ b/src/it/MCOMPILER-157/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java @@ -0,0 +1,118 @@ +package org.issue; + +/* + * 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 java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.util.List; +import java.util.stream.Collectors; + +import org.apache.maven.api.Session; +import org.apache.maven.api.di.Inject; +import org.apache.maven.api.plugin.Log; +import org.apache.maven.api.plugin.MojoException; +import org.apache.maven.api.plugin.annotations.LifecyclePhase; +import org.apache.maven.api.plugin.annotations.Mojo; +import org.apache.maven.api.plugin.annotations.Parameter; +import org.apache.maven.api.Project; +import org.apache.maven.api.ProjectScope; +import org.apache.maven.api.services.ProjectManager; +import org.apache.maven.shared.utils.io.FileUtils; + +@Mojo( name = "read-source", defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES ) +public class SourcePathReadGoal + implements org.apache.maven.api.plugin.Mojo +{ + + @Parameter + protected String sourceClass; + + @Parameter + protected String testSourceClass; + + @Inject + protected Project project; + + @Inject + protected Log log; + + @Inject + protected Session session; + + @SuppressWarnings( "unchecked" ) + public void execute() + throws MojoException + { + ProjectManager projectManager = session.getService(ProjectManager.class); + if ( sourceClass != null ) + { + log.info( "Checking compile source roots for: '" + sourceClass + "'" ); + assertGeneratedSourceFileFor( sourceClass, projectManager.getCompileSourceRoots(project, ProjectScope.MAIN) ); + } + + if ( testSourceClass != null ) + { + log.info( "Checking test-compile source roots for: '" + testSourceClass + "'" ); + assertGeneratedSourceFileFor( testSourceClass, projectManager.getCompileSourceRoots(project, ProjectScope.TEST) ); + } + } + + private void assertGeneratedSourceFileFor( String sourceClass, List sourceRoots ) + throws MojoException + { + String sourceFile = sourceClass.replace( '.', '/' ) + .concat( ".txt" ); + + boolean found = false; + for ( Path root : sourceRoots ) + { + File f = root.resolve( sourceFile ).toFile(); + log.info( "Looking for: " + f ); + if ( f.exists() ) + { + try + { + String[] nameParts = sourceClass.split( "\\." ); + String content = FileUtils.fileRead( f ); + if ( !nameParts[nameParts.length-1].equals( content ) ) + { + throw new MojoException( "Non-matching content in: " + f + "\n expected: '" + + sourceClass + "'\n found: '" + content + "'" ); + } + + found = true; + break; + } + catch ( IOException e ) + { + throw new MojoException( "Cannot read contents of: " + f, e ); + } + } + } + + if ( !found ) + { + throw new MojoException( "Cannot find generated source file: " + sourceFile + " in:\n " + + sourceRoots.stream().map( Path::toString ).collect(Collectors.joining( "\n " ) ) ); + } + } + +} diff --git a/src/it/MCOMPILER-157/pom.xml b/src/it/MCOMPILER-157/pom.xml index 9b2e7560..4c274cff 100644 --- a/src/it/MCOMPILER-157/pom.xml +++ b/src/it/MCOMPILER-157/pom.xml @@ -31,9 +31,15 @@ under the License. annotation-processor + annotation-verify annotation-user + + 8 + 8 + + diff --git a/src/it/MCOMPILER-170/invoker.properties b/src/it/MCOMPILER-170/invoker.properties index 868a2586..9f346f93 100644 --- a/src/it/MCOMPILER-170/invoker.properties +++ b/src/it/MCOMPILER-170/invoker.properties @@ -16,3 +16,4 @@ # under the License. invoker.goals = clean compile -T4 +invoker.maven.version = 3.0+ diff --git a/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App.java b/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App.java index 3fa54ed1..bcbf5dd6 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App.java +++ b/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,29 +18,35 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! */ -public class App { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App2.java b/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App2.java index 9a6511fc..6a22d395 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App2.java +++ b/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App2.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App2 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App2 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App3.java b/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App3.java index eb55f16f..d970eecf 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App3.java +++ b/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App3.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App3 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App3 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App4.java b/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App4.java index 1156f54d..1cce4d8d 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App4.java +++ b/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App4.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App4 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App4 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App5.java b/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App5.java index dd3c028a..beab680b 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App5.java +++ b/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App5.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App5 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App5 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App6.java b/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App6.java index ca09789f..c748ea2c 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App6.java +++ b/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App6.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App6 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App6 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App7.java b/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App7.java index e0f50da0..0b09cdfa 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App7.java +++ b/src/it/MCOMPILER-170/mcompiler-170-1/src/main/java/org/apache/maven/plugins/compiler/it/App7.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App7 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App7 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-1/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java b/src/it/MCOMPILER-170/mcompiler-170-1/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java index af3a4542..464f9af3 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-1/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java +++ b/src/it/MCOMPILER-170/mcompiler-170-1/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,7 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + import junit.framework.Test; import junit.framework.TestCase; @@ -25,27 +27,32 @@ /** * Unit test for simple App. */ -public class AppTest extends TestCase { +public class AppTest + extends TestCase +{ /** * Create the test case * * @param testName name of the test case */ - public AppTest(String testName) { - super(testName); + public AppTest( String testName ) + { + super( testName ); } /** * @return the suite of tests being tested */ - public static Test suite() { - return new TestSuite(AppTest.class); + public static Test suite() + { + return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ - public void testApp() { - assertTrue(true); + public void testApp() + { + assertTrue( true ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App.java b/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App.java index 3fa54ed1..bcbf5dd6 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App.java +++ b/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,29 +18,35 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! */ -public class App { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App2.java b/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App2.java index 9a6511fc..6a22d395 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App2.java +++ b/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App2.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App2 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App2 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App3.java b/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App3.java index eb55f16f..d970eecf 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App3.java +++ b/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App3.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App3 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App3 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App4.java b/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App4.java index 1156f54d..1cce4d8d 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App4.java +++ b/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App4.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App4 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App4 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App5.java b/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App5.java index dd3c028a..beab680b 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App5.java +++ b/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App5.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App5 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App5 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App6.java b/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App6.java index ca09789f..c748ea2c 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App6.java +++ b/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App6.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App6 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App6 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App7.java b/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App7.java index e0f50da0..0b09cdfa 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App7.java +++ b/src/it/MCOMPILER-170/mcompiler-170-2/src/main/java/org/apache/maven/plugins/compiler/it/App7.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App7 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App7 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-2/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java b/src/it/MCOMPILER-170/mcompiler-170-2/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java index af3a4542..464f9af3 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-2/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java +++ b/src/it/MCOMPILER-170/mcompiler-170-2/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,7 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + import junit.framework.Test; import junit.framework.TestCase; @@ -25,27 +27,32 @@ /** * Unit test for simple App. */ -public class AppTest extends TestCase { +public class AppTest + extends TestCase +{ /** * Create the test case * * @param testName name of the test case */ - public AppTest(String testName) { - super(testName); + public AppTest( String testName ) + { + super( testName ); } /** * @return the suite of tests being tested */ - public static Test suite() { - return new TestSuite(AppTest.class); + public static Test suite() + { + return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ - public void testApp() { - assertTrue(true); + public void testApp() + { + assertTrue( true ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App.java b/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App.java index 3fa54ed1..bcbf5dd6 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App.java +++ b/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,29 +18,35 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! */ -public class App { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App2.java b/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App2.java index 9a6511fc..6a22d395 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App2.java +++ b/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App2.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App2 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App2 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App3.java b/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App3.java index eb55f16f..d970eecf 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App3.java +++ b/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App3.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App3 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App3 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App4.java b/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App4.java index 1156f54d..1cce4d8d 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App4.java +++ b/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App4.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App4 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App4 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App5.java b/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App5.java index dd3c028a..beab680b 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App5.java +++ b/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App5.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App5 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App5 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App6.java b/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App6.java index ca09789f..c748ea2c 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App6.java +++ b/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App6.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App6 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App6 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App7.java b/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App7.java index e0f50da0..0b09cdfa 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App7.java +++ b/src/it/MCOMPILER-170/mcompiler-170-3/src/main/java/org/apache/maven/plugins/compiler/it/App7.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App7 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App7 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-3/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java b/src/it/MCOMPILER-170/mcompiler-170-3/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java index af3a4542..464f9af3 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-3/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java +++ b/src/it/MCOMPILER-170/mcompiler-170-3/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,7 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + import junit.framework.Test; import junit.framework.TestCase; @@ -25,27 +27,32 @@ /** * Unit test for simple App. */ -public class AppTest extends TestCase { +public class AppTest + extends TestCase +{ /** * Create the test case * * @param testName name of the test case */ - public AppTest(String testName) { - super(testName); + public AppTest( String testName ) + { + super( testName ); } /** * @return the suite of tests being tested */ - public static Test suite() { - return new TestSuite(AppTest.class); + public static Test suite() + { + return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ - public void testApp() { - assertTrue(true); + public void testApp() + { + assertTrue( true ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App.java b/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App.java index 3fa54ed1..bcbf5dd6 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App.java +++ b/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,29 +18,35 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! */ -public class App { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App2.java b/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App2.java index 9a6511fc..6a22d395 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App2.java +++ b/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App2.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App2 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App2 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App3.java b/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App3.java index eb55f16f..d970eecf 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App3.java +++ b/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App3.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App3 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App3 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App4.java b/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App4.java index 1156f54d..1cce4d8d 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App4.java +++ b/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App4.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App4 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App4 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App5.java b/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App5.java index dd3c028a..beab680b 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App5.java +++ b/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App5.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App5 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App5 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App6.java b/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App6.java index ca09789f..c748ea2c 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App6.java +++ b/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App6.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App6 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App6 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App7.java b/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App7.java index e0f50da0..0b09cdfa 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App7.java +++ b/src/it/MCOMPILER-170/mcompiler-170-4/src/main/java/org/apache/maven/plugins/compiler/it/App7.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,30 +18,36 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + /** * Hello world! * */ -public class App7 { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App7 +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } - public static void mainFoo(String[] args) { - System.out.println("Hello World!"); + public static void mainFoo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void bar(String[] args) { - System.out.println("Hello World!"); + public void bar( String[] args ) + { + System.out.println( "Hello World!" ); } - public void foo(String[] args) { - System.out.println("Hello World!"); + public void foo( String[] args ) + { + System.out.println( "Hello World!" ); } - public void barfoo(String[] args) { - System.out.println("Hello World!"); + public void barfoo( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/MCOMPILER-170/mcompiler-170-4/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java b/src/it/MCOMPILER-170/mcompiler-170-4/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java index af3a4542..464f9af3 100644 --- a/src/it/MCOMPILER-170/mcompiler-170-4/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java +++ b/src/it/MCOMPILER-170/mcompiler-170-4/src/test/java/org/apache/maven/plugins/compiler/it/AppTest.java @@ -1,3 +1,5 @@ +package org.apache.maven.plugins.compiler.it; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,7 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.plugins.compiler.it; + import junit.framework.Test; import junit.framework.TestCase; @@ -25,27 +27,32 @@ /** * Unit test for simple App. */ -public class AppTest extends TestCase { +public class AppTest + extends TestCase +{ /** * Create the test case * * @param testName name of the test case */ - public AppTest(String testName) { - super(testName); + public AppTest( String testName ) + { + super( testName ); } /** * @return the suite of tests being tested */ - public static Test suite() { - return new TestSuite(AppTest.class); + public static Test suite() + { + return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ - public void testApp() { - assertTrue(true); + public void testApp() + { + assertTrue( true ); } } diff --git a/src/it/MCOMPILER-170/pom.xml b/src/it/MCOMPILER-170/pom.xml index 38b81b9c..16c4653d 100644 --- a/src/it/MCOMPILER-170/pom.xml +++ b/src/it/MCOMPILER-170/pom.xml @@ -34,8 +34,13 @@ under the License. @project.version@ - + + + 8 + 8 + + mcompiler-170-1 mcompiler-170-2 diff --git a/src/it/MCOMPILER-190/src/main/java/org/example/pce/sample/Dummy.java b/src/it/MCOMPILER-190/src/main/java/org/example/pce/sample/Dummy.java index 00225397..96a49ffc 100644 --- a/src/it/MCOMPILER-190/src/main/java/org/example/pce/sample/Dummy.java +++ b/src/it/MCOMPILER-190/src/main/java/org/example/pce/sample/Dummy.java @@ -1,3 +1,5 @@ +package org.example.pce.sample; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,10 +18,10 @@ * specific language governing permissions and limitations * under the License. */ -package org.example.pce.sample; + public class Dummy { - public static void main(final String[] args) { - String dummy = new Integer(1); - } + public static void main(final String[] args) { + String dummy = new Integer(1); + } } diff --git a/src/it/MCOMPILER-192/src/main/java/dummy/HelloWorld.java b/src/it/MCOMPILER-192/src/main/java/dummy/HelloWorld.java index 7ceb91cb..f223c74d 100644 --- a/src/it/MCOMPILER-192/src/main/java/dummy/HelloWorld.java +++ b/src/it/MCOMPILER-192/src/main/java/dummy/HelloWorld.java @@ -1,25 +1,28 @@ -/* - * 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. - */ -package dummy; - -public class HelloWorld { - public static void main(String[] argv) { - System.out.println("Hello World"); - } -} +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. + */ + + +public class HelloWorld +{ + public static void main(String[] argv) { + System.out.println("Hello World"); + } +} diff --git a/src/it/MCOMPILER-192/verify.groovy b/src/it/MCOMPILER-192/verify.groovy index a23fe871..0bdd307e 100644 --- a/src/it/MCOMPILER-192/verify.groovy +++ b/src/it/MCOMPILER-192/verify.groovy @@ -1,3 +1,4 @@ + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -22,7 +23,7 @@ assert logFile.exists() def content = logFile.getText('UTF-8') def causedByExpected = content.contains ( 'Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure' ) -def twoFilesBeingCompiled = content.contains ( '[INFO] Compiling 2 source files with javac ' ) +def twoFilesBeingCompiled = content.contains ( '[INFO] Compiling 2 source files to ' ) def checkResult = content.contains ( '[INFO] BUILD FAILURE' ) def compilationFailure1 = content.contains( '[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:') diff --git a/src/it/MCOMPILER-197/pom.xml b/src/it/MCOMPILER-197/pom.xml index 353e10ec..3efa8426 100644 --- a/src/it/MCOMPILER-197/pom.xml +++ b/src/it/MCOMPILER-197/pom.xml @@ -27,7 +27,11 @@ under the License. org.issue compiler-test 1.0-SNAPSHOT - + + + 8 + 8 + diff --git a/src/it/MCOMPILER-197/src/main/java/org/issue/Person.java b/src/it/MCOMPILER-197/src/main/java/org/issue/Person.java index d80a49b9..701035c0 100644 --- a/src/it/MCOMPILER-197/src/main/java/org/issue/Person.java +++ b/src/it/MCOMPILER-197/src/main/java/org/issue/Person.java @@ -1,3 +1,5 @@ +package org.issue; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package org.issue; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -27,7 +28,6 @@ public class Person { @Id @GeneratedValue private long id; - private String name; public long getId() { diff --git a/src/it/MCOMPILER-203-processorpath/annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java b/src/it/MCOMPILER-203-processorpath/annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java index b2dfd6ca..a3dcbf9b 100644 --- a/src/it/MCOMPILER-203-processorpath/annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java +++ b/src/it/MCOMPILER-203-processorpath/annotation-processor/src/main/java/org/issue/SimpleAnnotationProcessor.java @@ -1,105 +1,121 @@ -/* - * 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. - */ -package org.issue; - -import javax.annotation.processing.AbstractProcessor; -import javax.annotation.processing.Filer; -import javax.annotation.processing.RoundEnvironment; -import javax.annotation.processing.SupportedAnnotationTypes; -import javax.annotation.processing.SupportedSourceVersion; -import javax.lang.model.SourceVersion; -import javax.lang.model.element.Element; -import javax.lang.model.element.Name; -import javax.lang.model.element.PackageElement; -import javax.lang.model.element.TypeElement; -import javax.lang.model.util.Elements; -import javax.tools.FileObject; -import javax.tools.JavaFileObject; -import javax.tools.StandardLocation; - -import java.io.IOException; -import java.io.Writer; -import java.util.Set; - -@SupportedSourceVersion(SourceVersion.RELEASE_6) -@SupportedAnnotationTypes("org.issue.SimpleAnnotation") -public class SimpleAnnotationProcessor extends AbstractProcessor { - - @Override - public boolean process(Set annotations, RoundEnvironment roundEnv) { - if (annotations.isEmpty()) { - return true; - } - - // assert that commons-lang3 is on the classpath - try { - getClass().getClassLoader().loadClass("org.apache.commons.lang3.StringUtils"); - } catch (ClassNotFoundException expected) { - throw new RuntimeException("Expected org.apache.commons.lang3.StringUtils to be on the processorpath," - + "because it is a declared dependency of the annotation processor."); - } - - // assert that commons-io is NOT on the classpath, as it is only a project dependency in "annotation-user" - try { - getClass().getClassLoader().loadClass("org.apache.commons.io.IOUtils"); - throw new RuntimeException("Expected a ClassNotFoundException because " - + "org.apache.commons.io.IOUtils is not supposed to be on the processorpath."); - } catch (ClassNotFoundException expected) { - // expected. - } - - Filer filer = processingEnv.getFiler(); - - Elements elementUtils = processingEnv.getElementUtils(); - - Set elements = - roundEnv.getElementsAnnotatedWith(annotations.iterator().next()); - - for (Element element : elements) { - Name name = element.getSimpleName(); - - PackageElement packageElement = elementUtils.getPackageOf(element); - - try { - Name packageName = packageElement.getQualifiedName(); - FileObject resource = - filer.createResource(StandardLocation.SOURCE_OUTPUT, packageName, name + ".txt", element); - - Writer writer = resource.openWriter(); - writer.write(name.toString()); - writer.close(); - - String className = name + "Companion"; - JavaFileObject javaFile = filer.createSourceFile(packageName + "." + className, element); - - Writer javaWriter = javaFile.openWriter(); - javaWriter.append("package ").append(packageName).append(";\n\n"); - javaWriter.append("public class ").append(className).append(" {\n"); - javaWriter.append(" public ").append(className).append("() {\n"); - javaWriter.append(" System.out.println(\"Hey there!\");\n"); - javaWriter.append(" }\n}\n"); - javaWriter.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - return !elements.isEmpty(); - } -} +package org.issue; + +/* + * 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 java.io.IOException; +import java.io.Writer; +import java.util.Set; + +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.Filer; +import javax.annotation.processing.RoundEnvironment; +import javax.annotation.processing.SupportedAnnotationTypes; +import javax.annotation.processing.SupportedSourceVersion; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.Element; +import javax.lang.model.element.Name; +import javax.lang.model.element.PackageElement; +import javax.lang.model.element.TypeElement; +import javax.lang.model.util.Elements; +import javax.tools.FileObject; +import javax.tools.JavaFileObject; +import javax.tools.StandardLocation; + +@SupportedSourceVersion( SourceVersion.RELEASE_6 ) +@SupportedAnnotationTypes( "org.issue.SimpleAnnotation" ) +public class SimpleAnnotationProcessor + extends AbstractProcessor +{ + + @Override + public boolean process( Set annotations, RoundEnvironment roundEnv ) + { + if ( annotations.isEmpty() ) + { + return true; + } + + // assert that commons-lang3 is on the classpath + try + { + getClass().getClassLoader().loadClass( "org.apache.commons.lang3.StringUtils" ); + } + catch ( ClassNotFoundException expected ) + { + throw new RuntimeException( "Expected org.apache.commons.lang3.StringUtils to be on the processorpath," + + "because it is a declared dependency of the annotation processor." ); + } + + // assert that commons-io is NOT on the classpath, as it is only a project dependency in "annotation-user" + try + { + getClass().getClassLoader().loadClass( "org.apache.commons.io.IOUtils" ); + throw new RuntimeException( "Expected a ClassNotFoundException because " + + "org.apache.commons.io.IOUtils is not supposed to be on the processorpath." ); + } + catch ( ClassNotFoundException expected ) + { + // expected. + } + + Filer filer = processingEnv.getFiler(); + + Elements elementUtils = processingEnv.getElementUtils(); + + Set elements = roundEnv.getElementsAnnotatedWith( annotations.iterator().next() ); + + for ( Element element : elements ) + { + Name name = element.getSimpleName(); + + PackageElement packageElement = elementUtils.getPackageOf( element ); + + try + { + Name packageName = packageElement.getQualifiedName(); + FileObject resource = + filer.createResource( StandardLocation.SOURCE_OUTPUT, packageName, name + + ".txt", element ); + + Writer writer = resource.openWriter(); + writer.write( name.toString() ); + writer.close(); + + String className = name + "Companion"; + JavaFileObject javaFile = filer.createSourceFile( packageName + "." + className, element ); + + Writer javaWriter = javaFile.openWriter(); + javaWriter.append( "package " ).append( packageName ).append( ";\n\n" ); + javaWriter.append( "public class " ).append( className ).append( " {\n" ); + javaWriter.append( " public " ).append( className ).append( "() {\n" ); + javaWriter.append( " System.out.println(\"Hey there!\");\n" ); + javaWriter.append( " }\n}\n" ); + javaWriter.close(); + } + catch ( IOException e ) + { + throw new RuntimeException( e ); + } + } + + return !elements.isEmpty(); + } + +} diff --git a/src/it/MCOMPILER-203-processorpath/annotation-user/pom.xml b/src/it/MCOMPILER-203-processorpath/annotation-user/pom.xml index 42cb8999..80d94fee 100644 --- a/src/it/MCOMPILER-203-processorpath/annotation-user/pom.xml +++ b/src/it/MCOMPILER-203-processorpath/annotation-user/pom.xml @@ -63,9 +63,9 @@ under the License. - org.apache.maven.plugins.compiler.it - annotation-verify-plugin - 1.0.0-SNAPSHOT + org.issue + annotation-verify + 1.0-SNAPSHOT verify-annotations diff --git a/src/it/MCOMPILER-203-processorpath/annotation-user/src/main/java/org/issue/SimpleAnnotation.java b/src/it/MCOMPILER-203-processorpath/annotation-user/src/main/java/org/issue/SimpleAnnotation.java index 5339365e..b867beb5 100644 --- a/src/it/MCOMPILER-203-processorpath/annotation-user/src/main/java/org/issue/SimpleAnnotation.java +++ b/src/it/MCOMPILER-203-processorpath/annotation-user/src/main/java/org/issue/SimpleAnnotation.java @@ -1,28 +1,31 @@ -/* - * 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. - */ -package org.issue; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.SOURCE) -public @interface SimpleAnnotation {} +package org.issue; + +/* + * 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 java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.SOURCE) +public @interface SimpleAnnotation { + +} diff --git a/src/it/MCOMPILER-203-processorpath/annotation-user/src/main/java/org/issue/SimpleObject.java b/src/it/MCOMPILER-203-processorpath/annotation-user/src/main/java/org/issue/SimpleObject.java index 18b8fc43..5b7a43f6 100644 --- a/src/it/MCOMPILER-203-processorpath/annotation-user/src/main/java/org/issue/SimpleObject.java +++ b/src/it/MCOMPILER-203-processorpath/annotation-user/src/main/java/org/issue/SimpleObject.java @@ -1,22 +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. - */ -package org.issue; - -@SimpleAnnotation -public class SimpleObject {} +package org.issue; + +/* + * 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. + */ + +@SimpleAnnotation +public class SimpleObject +{ + +} diff --git a/src/it/MCOMPILER-203-processorpath/annotation-user/src/test/java/org/issue/SimpleTestObject.java b/src/it/MCOMPILER-203-processorpath/annotation-user/src/test/java/org/issue/SimpleTestObject.java index 706dccf1..48aed126 100644 --- a/src/it/MCOMPILER-203-processorpath/annotation-user/src/test/java/org/issue/SimpleTestObject.java +++ b/src/it/MCOMPILER-203-processorpath/annotation-user/src/test/java/org/issue/SimpleTestObject.java @@ -1,22 +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. - */ -package org.issue; - -@SimpleAnnotation -public class SimpleTestObject {} +package org.issue; + +/* + * 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. + */ + +@SimpleAnnotation +public class SimpleTestObject +{ + +} diff --git a/src/it/MCOMPILER-203-processorpath/annotation-verify/pom.xml b/src/it/MCOMPILER-203-processorpath/annotation-verify/pom.xml new file mode 100644 index 00000000..a32bfe11 --- /dev/null +++ b/src/it/MCOMPILER-203-processorpath/annotation-verify/pom.xml @@ -0,0 +1,70 @@ + + + + + + 4.0.0 + + + org.issue + compiler-test + 1.0-SNAPSHOT + + + annotation-verify + maven-plugin + + + + org.apache.maven + maven-api-core + @mavenVersion@ + + + org.apache.maven.shared + maven-shared-utils + 3.3.3 + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + @mavenPluginPluginVersion@ + + foo + true + + + + mojo-descriptor + process-classes + + descriptor + + + + + + + diff --git a/src/it/MCOMPILER-203-processorpath/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java b/src/it/MCOMPILER-203-processorpath/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java new file mode 100644 index 00000000..289d867a --- /dev/null +++ b/src/it/MCOMPILER-203-processorpath/annotation-verify/src/main/java/org/issue/SourcePathReadGoal.java @@ -0,0 +1,118 @@ +package org.issue; + +/* + * 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 java.io.File; +import java.io.IOException; +import java.nio.file.Path; +import java.util.List; +import java.util.stream.Collectors; + +import org.apache.maven.api.Session; +import org.apache.maven.api.di.Inject; +import org.apache.maven.api.plugin.Log; +import org.apache.maven.api.plugin.MojoException; +import org.apache.maven.api.plugin.annotations.LifecyclePhase; +import org.apache.maven.api.plugin.annotations.Mojo; +import org.apache.maven.api.plugin.annotations.Parameter; +import org.apache.maven.api.Project; +import org.apache.maven.api.ProjectScope; +import org.apache.maven.api.services.ProjectManager; +import org.apache.maven.shared.utils.io.FileUtils; + +@Mojo( name = "read-source", defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES ) +public class SourcePathReadGoal + implements org.apache.maven.api.plugin.Mojo +{ + + @Parameter + protected String sourceClass; + + @Parameter + protected String testSourceClass; + + @Inject + protected Project project; + + @Inject + protected Log log; + + @Inject + protected Session session; + + @SuppressWarnings( "unchecked" ) + public void execute() + throws MojoException + { + ProjectManager projectManager = session.getService(ProjectManager.class); + if ( sourceClass != null ) + { + log.info( "Checking compile source roots for: '" + sourceClass + "'" ); + assertGeneratedSourceFileFor( sourceClass, projectManager.getCompileSourceRoots(project, ProjectScope.MAIN) ); + } + + if ( testSourceClass != null ) + { + log.info( "Checking test-compile source roots for: '" + testSourceClass + "'" ); + assertGeneratedSourceFileFor( testSourceClass, projectManager.getCompileSourceRoots(project, ProjectScope.TEST) ); + } + } + + private void assertGeneratedSourceFileFor( String sourceClass, List sourceRoots ) + throws MojoException + { + String sourceFile = sourceClass.replace( '.', '/' ) + .concat( ".txt" ); + + boolean found = false; + for ( Path root : sourceRoots ) + { + File f = root.resolve( sourceFile ).toFile(); + log.info( "Looking for: " + f ); + if ( f.exists() ) + { + try + { + String[] nameParts = sourceClass.split( "\\." ); + String content = FileUtils.fileRead( f ); + if ( !nameParts[nameParts.length-1].equals( content ) ) + { + throw new MojoException( "Non-matching content in: " + f + "\n expected: '" + + sourceClass + "'\n found: '" + content + "'" ); + } + + found = true; + break; + } + catch ( IOException e ) + { + throw new MojoException( "Cannot read contents of: " + f, e ); + } + } + } + + if ( !found ) + { + throw new MojoException( "Cannot find generated source file: " + sourceFile + " in:\n " + + sourceRoots.stream().map( Path::toString ).collect(Collectors.joining( "\n " ) ) ); + } + } + +} diff --git a/src/it/MCOMPILER-203-processorpath/pom.xml b/src/it/MCOMPILER-203-processorpath/pom.xml index 3f312d89..26afc67a 100644 --- a/src/it/MCOMPILER-203-processorpath/pom.xml +++ b/src/it/MCOMPILER-203-processorpath/pom.xml @@ -31,9 +31,15 @@ under the License. annotation-processor + annotation-verify annotation-user + + 8 + 8 + + diff --git a/src/it/MCOMPILER-205/src/main/java/dummy/HelloWorld.java b/src/it/MCOMPILER-205/src/main/java/dummy/HelloWorld.java index 7ceb91cb..f223c74d 100644 --- a/src/it/MCOMPILER-205/src/main/java/dummy/HelloWorld.java +++ b/src/it/MCOMPILER-205/src/main/java/dummy/HelloWorld.java @@ -1,25 +1,28 @@ -/* - * 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. - */ -package dummy; - -public class HelloWorld { - public static void main(String[] argv) { - System.out.println("Hello World"); - } -} +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. + */ + + +public class HelloWorld +{ + public static void main(String[] argv) { + System.out.println("Hello World"); + } +} diff --git a/src/it/MCOMPILER-205/src/main/java/dummy/package-info.java b/src/it/MCOMPILER-205/src/main/java/dummy/package-info.java index 9d2deff2..ed72542b 100644 --- a/src/it/MCOMPILER-205/src/main/java/dummy/package-info.java +++ b/src/it/MCOMPILER-205/src/main/java/dummy/package-info.java @@ -20,4 +20,4 @@ /** * This is the package javadoc */ -package dummy; +package dummy; \ No newline at end of file diff --git a/src/it/MCOMPILER-205/verify.groovy b/src/it/MCOMPILER-205/verify.groovy index 1041376b..1526f866 100644 --- a/src/it/MCOMPILER-205/verify.groovy +++ b/src/it/MCOMPILER-205/verify.groovy @@ -1,3 +1,4 @@ + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/src/it/MCOMPILER-224/annotation-processor/src/main/java/org/issue/MCompiler224.java b/src/it/MCOMPILER-224/annotation-processor/src/main/java/org/issue/MCompiler224.java index 045a64b1..c47ffa04 100644 --- a/src/it/MCOMPILER-224/annotation-processor/src/main/java/org/issue/MCompiler224.java +++ b/src/it/MCOMPILER-224/annotation-processor/src/main/java/org/issue/MCompiler224.java @@ -1,3 +1,5 @@ +package org.issue; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,6 +18,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.issue; -public @interface MCompiler224 {} + +public @interface MCompiler224 +{ + +} diff --git a/src/it/MCOMPILER-224/annotation-processor/src/main/java/org/issue/MCompiler224AnnotationProcessor.java b/src/it/MCOMPILER-224/annotation-processor/src/main/java/org/issue/MCompiler224AnnotationProcessor.java index c7ded6bc..2e92f08c 100644 --- a/src/it/MCOMPILER-224/annotation-processor/src/main/java/org/issue/MCompiler224AnnotationProcessor.java +++ b/src/it/MCOMPILER-224/annotation-processor/src/main/java/org/issue/MCompiler224AnnotationProcessor.java @@ -1,3 +1,5 @@ +package org.issue; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,7 +18,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.issue; + + +import java.util.Set; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.Messager; @@ -27,31 +31,38 @@ import javax.lang.model.element.TypeElement; import javax.tools.Diagnostic.Kind; -import java.util.Set; - /* @formatter:off */ -@SupportedAnnotationTypes({"org.issue.MCompiler224"}) +@SupportedAnnotationTypes( { + "org.issue.MCompiler224" +} ) /* @formatter:on */ -@SupportedSourceVersion(SourceVersion.RELEASE_6) -public class MCompiler224AnnotationProcessor extends AbstractProcessor { +@SupportedSourceVersion( SourceVersion.RELEASE_6 ) +public class MCompiler224AnnotationProcessor + extends AbstractProcessor +{ @Override - public boolean process(final Set elts, final RoundEnvironment env) { - if (elts.isEmpty()) { + public boolean process( final Set elts, final RoundEnvironment env ) + { + if ( elts.isEmpty() ) + { return true; } final Messager messager = this.processingEnv.getMessager(); - for (final Kind kind : Kind.values()) { - if (Kind.ERROR == kind) { + for ( final Kind kind : Kind.values() ) + { + if ( Kind.ERROR == kind ) + { continue; } - System.out.println("Testing message for: " + kind); - messager.printMessage(kind, kind + " Test message."); + System.out.println( "Testing message for: " + kind ); + messager.printMessage( kind, kind + " Test message." ); } return true; } + } diff --git a/src/it/MCOMPILER-224/annotation-user/src/main/java/org/issue/user/User.java b/src/it/MCOMPILER-224/annotation-user/src/main/java/org/issue/user/User.java index 660beafe..38b2ebd5 100644 --- a/src/it/MCOMPILER-224/annotation-user/src/main/java/org/issue/user/User.java +++ b/src/it/MCOMPILER-224/annotation-user/src/main/java/org/issue/user/User.java @@ -1,3 +1,5 @@ +package org.issue.user; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,9 +18,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.issue.user; + import org.issue.MCompiler224; @MCompiler224 -public class User {} +public class User +{ + +} diff --git a/src/it/MCOMPILER-224/pom.xml b/src/it/MCOMPILER-224/pom.xml index 9b2e7560..f1ffe043 100644 --- a/src/it/MCOMPILER-224/pom.xml +++ b/src/it/MCOMPILER-224/pom.xml @@ -34,6 +34,11 @@ under the License. annotation-user + + 8 + 8 + + diff --git a/src/it/MCOMPILER-228/src/main/java/example/FinalExample.java b/src/it/MCOMPILER-228/src/main/java/example/FinalExample.java index dd510e86..bb577774 100644 --- a/src/it/MCOMPILER-228/src/main/java/example/FinalExample.java +++ b/src/it/MCOMPILER-228/src/main/java/example/FinalExample.java @@ -1,40 +1,49 @@ -/* - * 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. - */ -package example; - -import java.util.Comparator; - -public class FinalExample { - public static final Comparator comparator = (o1, o2) -> { - final String desc1 = o1; - final String desc2 = o2; - final int compareTo; - if (desc1 == null) { - compareTo = -1; - } else if (desc2 == null) { - compareTo = 1; - } else { - compareTo = desc1.compareTo(desc2); - } - if (compareTo == 0) { - return 3; - } - return compareTo; - }; -} +package example; + +/* + * 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 java.util.Comparator; + +public class FinalExample +{ + public static final Comparator comparator = ( o1, o2 ) -> + { + final String desc1 = o1; + final String desc2 = o2; + final int compareTo; + if ( desc1 == null ) + { + compareTo = -1; + } + else if ( desc2 == null ) + { + compareTo = 1; + } + else + { + compareTo = desc1.compareTo( desc2 ); + } + if ( compareTo == 0 ) + { + return 3; + } + return compareTo; + }; +} diff --git a/src/it/MCOMPILER-260_customArguments/src/main/java/com/foo/MyClass.java b/src/it/MCOMPILER-260_customArguments/src/main/java/com/foo/MyClass.java index f646e4ae..dae085a4 100644 --- a/src/it/MCOMPILER-260_customArguments/src/main/java/com/foo/MyClass.java +++ b/src/it/MCOMPILER-260_customArguments/src/main/java/com/foo/MyClass.java @@ -1,21 +1,25 @@ -/* - * 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. - */ -package com.foo; - -public class MyClass {} +package com.foo; + +/* + * 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/MCOMPILER-268_modulepath/src/main/java/com/foo/MyClass.java b/src/it/MCOMPILER-268_modulepath/src/main/java/com/foo/MyClass.java index f646e4ae..dae085a4 100644 --- a/src/it/MCOMPILER-268_modulepath/src/main/java/com/foo/MyClass.java +++ b/src/it/MCOMPILER-268_modulepath/src/main/java/com/foo/MyClass.java @@ -1,21 +1,25 @@ -/* - * 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. - */ -package com.foo; - -public class MyClass {} +package com.foo; + +/* + * 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/MCOMPILER-268_modulepath/src/main/java/module-info.java b/src/it/MCOMPILER-268_modulepath/src/main/java/module-info.java index 029b6e71..d9800e36 100644 --- a/src/it/MCOMPILER-268_modulepath/src/main/java/module-info.java +++ b/src/it/MCOMPILER-268_modulepath/src/main/java/module-info.java @@ -1,22 +1,22 @@ -/* - * 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. - */ - -module M.N { - requires org.apache.commons.lang3; -} +/* + * 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. + */ + +module M.N { + requires org.apache.commons.lang3; +} \ No newline at end of file diff --git a/src/it/MCOMPILER-268_modulepath/src/test/java/com/foo/MyTest.java b/src/it/MCOMPILER-268_modulepath/src/test/java/com/foo/MyTest.java index 072b8086..efb936e6 100644 --- a/src/it/MCOMPILER-268_modulepath/src/test/java/com/foo/MyTest.java +++ b/src/it/MCOMPILER-268_modulepath/src/test/java/com/foo/MyTest.java @@ -1,25 +1,28 @@ -/* - * 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. - */ -package com.foo; - -import junit.framework.TestCase; - -public class MyTest extends TestCase { - private MyClass myClass = new MyClass(); -} +package com.foo; + +/* + * 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 +{ + private MyClass myClass = new MyClass(); +} diff --git a/src/it/MCOMPILER-270_release/src/main/java/MyClass.java b/src/it/MCOMPILER-270_release/src/main/java/MyClass.java index d4132bb2..4f947346 100644 --- a/src/it/MCOMPILER-270_release/src/main/java/MyClass.java +++ b/src/it/MCOMPILER-270_release/src/main/java/MyClass.java @@ -1,21 +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. - */ -package foo; - -public class MyClass {} +/* + * 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/MCOMPILER-270_release/src/test/java/MyTest.java b/src/it/MCOMPILER-270_release/src/test/java/MyTest.java index 77db4f1d..d80ce855 100644 --- a/src/it/MCOMPILER-270_release/src/test/java/MyTest.java +++ b/src/it/MCOMPILER-270_release/src/test/java/MyTest.java @@ -1,23 +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. - */ -package foo; - -import junit.framework.TestCase; - -public class MyTest extends TestCase {} +/* + * 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/MCOMPILER-272/processor1/src/main/java/processor1/Processor1.java b/src/it/MCOMPILER-272/processor1/src/main/java/processor1/Processor1.java index d1638492..319d2740 100644 --- a/src/it/MCOMPILER-272/processor1/src/main/java/processor1/Processor1.java +++ b/src/it/MCOMPILER-272/processor1/src/main/java/processor1/Processor1.java @@ -6,9 +6,9 @@ * 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 @@ -18,18 +18,21 @@ */ package processor1; +import java.util.Set; + import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.lang.model.element.TypeElement; -import java.util.Set; - @SupportedAnnotationTypes({"java.lang.SuppressWarnings"}) -public class Processor1 extends AbstractProcessor { +public class Processor1 + extends AbstractProcessor +{ @Override - public boolean process(Set annotations, RoundEnvironment roundEnv) { - System.out.println("Run processor1"); + public boolean process ( Set annotations, RoundEnvironment roundEnv ) + { + System.out.println( "Run processor1" ); return false; } } diff --git a/src/it/MCOMPILER-272/processor2-dep/src/main/java/processor2/dep/Foo.java b/src/it/MCOMPILER-272/processor2-dep/src/main/java/processor2/dep/Foo.java index f9fa52a5..bd1e92a4 100644 --- a/src/it/MCOMPILER-272/processor2-dep/src/main/java/processor2/dep/Foo.java +++ b/src/it/MCOMPILER-272/processor2-dep/src/main/java/processor2/dep/Foo.java @@ -6,9 +6,9 @@ * 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 @@ -18,4 +18,7 @@ */ package processor2.dep; -public class Foo {} +public class Foo +{ + +} diff --git a/src/it/MCOMPILER-272/processor2/src/main/java/processor2/Processor2.java b/src/it/MCOMPILER-272/processor2/src/main/java/processor2/Processor2.java index c2adcb04..b96a20f4 100644 --- a/src/it/MCOMPILER-272/processor2/src/main/java/processor2/Processor2.java +++ b/src/it/MCOMPILER-272/processor2/src/main/java/processor2/Processor2.java @@ -6,9 +6,9 @@ * 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 @@ -18,18 +18,21 @@ */ package processor2; +import java.util.Set; + import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.lang.model.element.TypeElement; -import java.util.Set; - @SupportedAnnotationTypes({"java.lang.SuppressWarnings"}) -public class Processor2 extends AbstractProcessor { +public class Processor2 + extends AbstractProcessor +{ @Override - public boolean process(Set annotations, RoundEnvironment roundEnv) { - System.out.println("Run processor2"); + public boolean process ( Set annotations, RoundEnvironment roundEnv ) + { + System.out.println( "Run processor2" ); new processor2.dep.Foo(); return false; } diff --git a/src/it/MCOMPILER-272/project/src/main/java/project/Project.java b/src/it/MCOMPILER-272/project/src/main/java/project/Project.java index be9e170a..9f00a997 100644 --- a/src/it/MCOMPILER-272/project/src/main/java/project/Project.java +++ b/src/it/MCOMPILER-272/project/src/main/java/project/Project.java @@ -6,9 +6,9 @@ * 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 @@ -20,7 +20,11 @@ import java.util.List; -public class Project { - @SuppressWarnings("rawtypes") - public void foo(List toto) {} +public class Project +{ + @SuppressWarnings( "rawtypes" ) + public void foo( List toto ) + { + + } } diff --git a/src/it/MCOMPILER-275_separate-moduleinfo/invoker.properties b/src/it/MCOMPILER-275_separate-moduleinfo/invoker.properties index 028c62b2..66f3f58e 100644 --- a/src/it/MCOMPILER-275_separate-moduleinfo/invoker.properties +++ b/src/it/MCOMPILER-275_separate-moduleinfo/invoker.properties @@ -17,3 +17,5 @@ invoker.java.version = 1.8+ invoker.toolchain.jdk.version=1.9 +# Due to toolchain support +invoker.maven.version = 3.3.1+ \ No newline at end of file diff --git a/src/it/MCOMPILER-275_separate-moduleinfo/src/main/java/com/foo/MyClass.java b/src/it/MCOMPILER-275_separate-moduleinfo/src/main/java/com/foo/MyClass.java index f646e4ae..dae085a4 100644 --- a/src/it/MCOMPILER-275_separate-moduleinfo/src/main/java/com/foo/MyClass.java +++ b/src/it/MCOMPILER-275_separate-moduleinfo/src/main/java/com/foo/MyClass.java @@ -1,21 +1,25 @@ -/* - * 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. - */ -package com.foo; - -public class MyClass {} +package com.foo; + +/* + * 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/MCOMPILER-275_separate-moduleinfo/src/main/java/module-info.java b/src/it/MCOMPILER-275_separate-moduleinfo/src/main/java/module-info.java index da90c2b9..c0e023a4 100644 --- a/src/it/MCOMPILER-275_separate-moduleinfo/src/main/java/module-info.java +++ b/src/it/MCOMPILER-275_separate-moduleinfo/src/main/java/module-info.java @@ -1,19 +1,22 @@ -/* - * 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. - */ -module M.N {} +/* + * 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. + */ + +module M.N { + +} \ No newline at end of file diff --git a/src/it/MCOMPILER-275_separate-moduleinfo/src/test/java/com/foo/MyTest.java b/src/it/MCOMPILER-275_separate-moduleinfo/src/test/java/com/foo/MyTest.java index 072b8086..efb936e6 100644 --- a/src/it/MCOMPILER-275_separate-moduleinfo/src/test/java/com/foo/MyTest.java +++ b/src/it/MCOMPILER-275_separate-moduleinfo/src/test/java/com/foo/MyTest.java @@ -1,25 +1,28 @@ -/* - * 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. - */ -package com.foo; - -import junit.framework.TestCase; - -public class MyTest extends TestCase { - private MyClass myClass = new MyClass(); -} +package com.foo; + +/* + * 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 +{ + private MyClass myClass = new MyClass(); +} diff --git a/src/it/MCOMPILER-275_separate-moduleinfo/verify.groovy b/src/it/MCOMPILER-275_separate-moduleinfo/verify.groovy index 8bab9804..baf07f7b 100644 --- a/src/it/MCOMPILER-275_separate-moduleinfo/verify.groovy +++ b/src/it/MCOMPILER-275_separate-moduleinfo/verify.groovy @@ -20,9 +20,7 @@ def log = new File( basedir, 'build.log').text assert log.count( "[INFO] Toolchain in maven-compiler-plugin: JDK" ) == 1 -assert log.count( "[INFO] Recompiling the module because of changed source code." ) == 1 -assert log.count( "[INFO] Recompiling the module because of added or removed source files." ) == 1 -assert log.count( "[INFO] Recompiling the module because of changed dependency." ) == 1 +assert log.count( "[INFO] Changes detected - recompiling the module!" ) == 3 // major_version: 52 = java8 -> execution id "base-compile" assert new File( basedir, 'target/classes/com/foo/MyClass.class' ).bytes[7] == 52 diff --git a/src/it/MCOMPILER-284/src/main/java/com/foo/MyClass.java b/src/it/MCOMPILER-284/src/main/java/com/foo/MyClass.java index f646e4ae..7370ac08 100644 --- a/src/it/MCOMPILER-284/src/main/java/com/foo/MyClass.java +++ b/src/it/MCOMPILER-284/src/main/java/com/foo/MyClass.java @@ -1,3 +1,5 @@ +package com.foo; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,6 +18,8 @@ * specific language governing permissions and limitations * under the License. */ -package com.foo; -public class MyClass {} +public class MyClass +{ + +} diff --git a/src/it/MCOMPILER-284/src/test/java/com/foo/MyTest.java b/src/it/MCOMPILER-284/src/test/java/com/foo/MyTest.java index 072b8086..f152b90e 100644 --- a/src/it/MCOMPILER-284/src/test/java/com/foo/MyTest.java +++ b/src/it/MCOMPILER-284/src/test/java/com/foo/MyTest.java @@ -1,3 +1,5 @@ +package com.foo; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,10 +18,11 @@ * specific language governing permissions and limitations * under the License. */ -package com.foo; import junit.framework.TestCase; -public class MyTest extends TestCase { +public class MyTest + extends TestCase +{ private MyClass myClass = new MyClass(); } diff --git a/src/it/MCOMPILER-294/app/src/main/java/module-info.java b/src/it/MCOMPILER-294/app/src/main/java/module-info.java index d90b8a19..3cda7211 100644 --- a/src/it/MCOMPILER-294/app/src/main/java/module-info.java +++ b/src/it/MCOMPILER-294/app/src/main/java/module-info.java @@ -1,22 +1,22 @@ -/* - * 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. - */ - -module org.maven.test.app { - requires org.maven.test.lib; -} +/* + * 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. + */ + +module org.maven.test.app { + requires org.maven.test.lib; +} \ No newline at end of file diff --git a/src/it/MCOMPILER-294/app/src/main/java/org/maven/test/app/Main.java b/src/it/MCOMPILER-294/app/src/main/java/org/maven/test/app/Main.java index cdd399a9..5d94eec5 100644 --- a/src/it/MCOMPILER-294/app/src/main/java/org/maven/test/app/Main.java +++ b/src/it/MCOMPILER-294/app/src/main/java/org/maven/test/app/Main.java @@ -1,31 +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. - */ -package org.maven.test.app; - -import org.maven.test.lib.Sout; - -public class Main { - - /** - * @param args - */ - public static void main(String[] args) { - Sout.println(args); - } -} +package org.maven.test.app; + +/* + * 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 org.maven.test.lib.Sout; + +public class Main { + + /** + * @param args + */ + public static void main(String[] args) { + Sout.println( args ); + } +} \ No newline at end of file diff --git a/src/it/MCOMPILER-294/lib/src/main/java/module-info.java b/src/it/MCOMPILER-294/lib/src/main/java/module-info.java index 52414cf8..a218436f 100644 --- a/src/it/MCOMPILER-294/lib/src/main/java/module-info.java +++ b/src/it/MCOMPILER-294/lib/src/main/java/module-info.java @@ -1,22 +1,22 @@ -/* - * 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. - */ - -module org.maven.test.lib { - exports org.maven.test.lib; -} +/* + * 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. + */ + +module org.maven.test.lib { + exports org.maven.test.lib; +} \ No newline at end of file diff --git a/src/it/MCOMPILER-294/lib/src/main/java/org/maven/test/lib/Sout.java b/src/it/MCOMPILER-294/lib/src/main/java/org/maven/test/lib/Sout.java index 99c65f94..658044ec 100644 --- a/src/it/MCOMPILER-294/lib/src/main/java/org/maven/test/lib/Sout.java +++ b/src/it/MCOMPILER-294/lib/src/main/java/org/maven/test/lib/Sout.java @@ -1,31 +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. - */ -package org.maven.test.lib; - -public class Sout { - - /** - * @param args - */ - public static void println(String[] args) { - for (String string : args) { - System.out.println(args); - } - } -} +package org.maven.test.lib; + +/* + * 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 Sout { + + /** + * @param args + */ + public static void println(String[] args) { + for ( String string : args ) + { + System.out.println( args ); + } + } +} \ No newline at end of file diff --git a/src/it/MCOMPILER-298/invoker.properties b/src/it/MCOMPILER-298/invoker.properties index b1a04637..928055c1 100644 --- a/src/it/MCOMPILER-298/invoker.properties +++ b/src/it/MCOMPILER-298/invoker.properties @@ -15,4 +15,5 @@ # specific language governing permissions and limitations # under the License. +invoker.java.version = 1.8+ invoker.goals = test diff --git a/src/it/MCOMPILER-298/src/main/java/com/foo/ParameterClass.java b/src/it/MCOMPILER-298/src/main/java/com/foo/ParameterClass.java index 44d79122..439e1e1e 100644 --- a/src/it/MCOMPILER-298/src/main/java/com/foo/ParameterClass.java +++ b/src/it/MCOMPILER-298/src/main/java/com/foo/ParameterClass.java @@ -1,3 +1,5 @@ +package com.foo; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,10 +18,12 @@ * specific language governing permissions and limitations * under the License. */ -package com.foo; -public class ParameterClass { - public void method(String parameterName) { + +public class ParameterClass +{ + public void method( String parameterName ) + { // nothing } } diff --git a/src/it/MCOMPILER-298/src/test/java/com/foo/ParameterTest.java b/src/it/MCOMPILER-298/src/test/java/com/foo/ParameterTest.java index 42d771df..b552b774 100644 --- a/src/it/MCOMPILER-298/src/test/java/com/foo/ParameterTest.java +++ b/src/it/MCOMPILER-298/src/test/java/com/foo/ParameterTest.java @@ -1,3 +1,5 @@ +package com.foo; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,21 +18,19 @@ * specific language governing permissions and limitations * under the License. */ -package com.foo; + +import static org.junit.Assert.*; import org.junit.Test; -import static org.junit.Assert.*; -public class ParameterTest { + +public class ParameterTest +{ @Test - public void testParameter() throws Exception { - assertEquals( - "parameterName", - ParameterClass.class - .getMethod("method", String.class) - .getParameters()[0] - .getName()); + public void testParameter() throws Exception + { + assertEquals( "parameterName", ParameterClass.class.getMethod( "method", String.class ).getParameters()[0].getName() ); } } diff --git a/src/it/MCOMPILER-321_pathexceptions/src/main/java/module-info.java b/src/it/MCOMPILER-321_pathexceptions/src/main/java/module-info.java index a57384df..0f43b063 100644 --- a/src/it/MCOMPILER-321_pathexceptions/src/main/java/module-info.java +++ b/src/it/MCOMPILER-321_pathexceptions/src/main/java/module-info.java @@ -6,9 +6,9 @@ * 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 @@ -17,4 +17,6 @@ * under the License. */ -module M.N {} +module M.N { + +} \ No newline at end of file diff --git a/src/it/MCOMPILER-321_pathexceptions/src/test/java/test/MyTest.java b/src/it/MCOMPILER-321_pathexceptions/src/test/java/test/MyTest.java index c42edd69..e2e08352 100644 --- a/src/it/MCOMPILER-321_pathexceptions/src/test/java/test/MyTest.java +++ b/src/it/MCOMPILER-321_pathexceptions/src/test/java/test/MyTest.java @@ -1,3 +1,5 @@ +package test; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,6 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package test; -public class MyTest {} +public class MyTest +{ +} \ No newline at end of file diff --git a/src/it/MCOMPILER-328_multiReleaseOutput/src/main/java/MyClass.java b/src/it/MCOMPILER-328_multiReleaseOutput/src/main/java/MyClass.java index d4132bb2..4945381a 100644 --- a/src/it/MCOMPILER-328_multiReleaseOutput/src/main/java/MyClass.java +++ b/src/it/MCOMPILER-328_multiReleaseOutput/src/main/java/MyClass.java @@ -6,9 +6,9 @@ * 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 @@ -16,6 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class MyClass {} +public class MyClass +{ + +} diff --git a/src/it/MCOMPILER-328_multiReleaseOutput/verify.groovy b/src/it/MCOMPILER-328_multiReleaseOutput/verify.groovy index f3423da7..ea03de5e 100644 --- a/src/it/MCOMPILER-328_multiReleaseOutput/verify.groovy +++ b/src/it/MCOMPILER-328_multiReleaseOutput/verify.groovy @@ -17,6 +17,6 @@ * under the License. */ -assert !new File( basedir, 'target/classes/foo/MyClass.class').exists() +assert !new File( basedir, 'target/classes/MyClass.class').exists() -assert new File( basedir, 'target/classes/META-INF/versions/9/foo/MyClass.class').exists() \ No newline at end of file +assert new File( basedir, 'target/classes/META-INF/versions/9/MyClass.class').exists() \ No newline at end of file diff --git a/src/it/MCOMPILER-336_incremental-modulepath/a/src/main/java/module-info.java b/src/it/MCOMPILER-336_incremental-modulepath/a/src/main/java/module-info.java index aef91dbb..234b5f94 100644 --- a/src/it/MCOMPILER-336_incremental-modulepath/a/src/main/java/module-info.java +++ b/src/it/MCOMPILER-336_incremental-modulepath/a/src/main/java/module-info.java @@ -16,4 +16,6 @@ * specific language governing permissions and limitations * under the License. */ -module test.a {} +module test.a +{ +} diff --git a/src/it/MCOMPILER-336_incremental-modulepath/b/src/main/java/module-info.java b/src/it/MCOMPILER-336_incremental-modulepath/b/src/main/java/module-info.java index f2213e3c..c9f16f17 100644 --- a/src/it/MCOMPILER-336_incremental-modulepath/b/src/main/java/module-info.java +++ b/src/it/MCOMPILER-336_incremental-modulepath/b/src/main/java/module-info.java @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -module test.b { +module test.b +{ requires transitive test.a; } diff --git a/src/it/MCOMPILER-336_incremental-modulepath/b/src/main/java/test/Foo.java b/src/it/MCOMPILER-336_incremental-modulepath/b/src/main/java/test/Foo.java index 0ec20eb3..c22b20aa 100644 --- a/src/it/MCOMPILER-336_incremental-modulepath/b/src/main/java/test/Foo.java +++ b/src/it/MCOMPILER-336_incremental-modulepath/b/src/main/java/test/Foo.java @@ -1,3 +1,5 @@ +package org.opengis.annotation; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,6 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package org.opengis.annotation; -public class Foo {} +public class Foo { +} diff --git a/src/it/MCOMPILER-336_incremental-modulepath/b/src/main/java/test/package-info.java b/src/it/MCOMPILER-336_incremental-modulepath/b/src/main/java/test/package-info.java index d4eae974..41a65d1f 100644 --- a/src/it/MCOMPILER-336_incremental-modulepath/b/src/main/java/test/package-info.java +++ b/src/it/MCOMPILER-336_incremental-modulepath/b/src/main/java/test/package-info.java @@ -1,3 +1,5 @@ +package org.opengis.annotation; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -15,5 +17,4 @@ * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - */ -package org.opengis.annotation; + */ \ No newline at end of file diff --git a/src/it/MCOMPILER-346/src/main/java/org/jenkinsci/test/acceptance/server/PooledJenkinsController.java b/src/it/MCOMPILER-346/src/main/java/org/jenkinsci/test/acceptance/server/PooledJenkinsController.java index 06706f90..f7fbf61f 100644 --- a/src/it/MCOMPILER-346/src/main/java/org/jenkinsci/test/acceptance/server/PooledJenkinsController.java +++ b/src/it/MCOMPILER-346/src/main/java/org/jenkinsci/test/acceptance/server/PooledJenkinsController.java @@ -1,3 +1,5 @@ +package org.jenkinsci.test.acceptance.server; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,10 +18,8 @@ * specific language governing permissions and limitations * under the License. */ -package org.jenkinsci.test.acceptance.server; import javax.inject.Inject; - import java.io.File; import java.io.IOException; import java.net.URL; @@ -27,14 +27,6 @@ import java.util.List; import java.util.concurrent.Executors; -import com.cloudbees.sdk.extensibility.Extension; -import com.google.inject.Injector; -import hudson.remoting.Callable; -import hudson.remoting.Channel; -import hudson.remoting.Channel.Mode; -import hudson.remoting.ChannelBuilder; -import jnr.unixsocket.UnixSocketAddress; -import jnr.unixsocket.UnixSocketChannel; import org.jenkinsci.remoting.RoleChecker; import org.jenkinsci.test.acceptance.controller.IJenkinsController; import org.jenkinsci.test.acceptance.controller.JenkinsController; @@ -43,6 +35,15 @@ import org.jenkinsci.test.acceptance.log.LogListener; import org.jenkinsci.test.acceptance.log.LogSplitter; +import com.cloudbees.sdk.extensibility.Extension; +import com.google.inject.Injector; + +import hudson.remoting.Callable; +import hudson.remoting.Channel; +import hudson.remoting.Channel.Mode; +import hudson.remoting.ChannelBuilder; +import jnr.unixsocket.UnixSocketAddress; +import jnr.unixsocket.UnixSocketChannel; import static java.lang.System.*; /** @@ -75,7 +76,7 @@ public void removeLogListener(LogListener l) { } private boolean connect() throws IOException { - if (conn != null) return false; + if (conn != null) return false; System.out.println("Requesting jut instance using socket " + socket.getAbsolutePath()); UnixSocketAddress address = new UnixSocketAddress(socket); @@ -86,7 +87,7 @@ private boolean connect() throws IOException { .build(ChannelStream.in(conn), ChannelStream.out(conn)); try { - controller = (IJenkinsController) channel.waitForRemoteProperty("controller"); + controller = (IJenkinsController)channel.waitForRemoteProperty("controller"); controller.start(); url = controller.getUrl(); @@ -95,7 +96,7 @@ private boolean connect() throws IOException { } final LogListener l = channel.export(LogListener.class, splitter); - channel.call(new InstallLogger(controller, l)); + channel.call(new InstallLogger(controller,l)); for (byte[] content : toUnpack) { controller.populateJenkinsHome(content, false); @@ -132,7 +133,8 @@ public void populateJenkinsHome(byte[] template, boolean clean) throws IOExcepti @Override public URL getUrl() { - if (url == null) throw new IllegalStateException("This controller has not been started"); + if (url==null) + throw new IllegalStateException("This controller has not been started"); return url; } @@ -144,7 +146,8 @@ public void tearDown() throws IOException { } catch (InterruptedException e) { throw new IOException(e); } finally { - if (conn != null) conn.close(); + if (conn !=null) + conn.close(); conn = null; } } @@ -153,7 +156,7 @@ public void tearDown() throws IOException { public void diagnose(Throwable cause) { // TODO: Report jenkins log cause.printStackTrace(out); - if (getenv("INTERACTIVE") != null && getenv("INTERACTIVE").equals("true")) { + if(getenv("INTERACTIVE") != null && getenv("INTERACTIVE").equals("true")){ out.println("Commencing interactive debugging. Browser session was kept open."); out.println("Press return to proceed."); try { @@ -166,8 +169,7 @@ public void diagnose(Throwable cause) { @Extension public static class FactoryImpl extends LocalFactoryImpl { - @Inject - Injector i; + @Inject Injector i; @Override public String getId() { @@ -202,7 +204,8 @@ public Void call() throws IOException { } @Override - public void checkRoles(RoleChecker checker) throws SecurityException {} + public void checkRoles(RoleChecker checker) throws SecurityException { + } private static final long serialVersionUID = 1L; } diff --git a/src/it/MCOMPILER-349_dependencyChanged/dependent-module/src/main/java/Main.java b/src/it/MCOMPILER-349_dependencyChanged/dependent-module/src/main/java/Main.java index 3f50a05e..f77ad070 100644 --- a/src/it/MCOMPILER-349_dependencyChanged/dependent-module/src/main/java/Main.java +++ b/src/it/MCOMPILER-349_dependencyChanged/dependent-module/src/main/java/Main.java @@ -16,11 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class Main { - public static void main(String[] args) { +public class Main +{ + public static void main( String[] args ) + { TestService testService = new TestService(); testService.run(); } -} +} \ No newline at end of file diff --git a/src/it/MCOMPILER-349_dependencyChanged/service/src/main/java/TestService.java b/src/it/MCOMPILER-349_dependencyChanged/service/src/main/java/TestService.java index 08e2016a..df21d267 100644 --- a/src/it/MCOMPILER-349_dependencyChanged/service/src/main/java/TestService.java +++ b/src/it/MCOMPILER-349_dependencyChanged/service/src/main/java/TestService.java @@ -16,9 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class TestService { +public class TestService +{ - public void run() {} -} + public void run() + { + + } +} \ No newline at end of file diff --git a/src/it/MCOMPILER-349_dependencyChanged/verify.groovy b/src/it/MCOMPILER-349_dependencyChanged/verify.groovy index f09d28da..c2182819 100644 --- a/src/it/MCOMPILER-349_dependencyChanged/verify.groovy +++ b/src/it/MCOMPILER-349_dependencyChanged/verify.groovy @@ -1,3 +1,4 @@ + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/src/it/MCOMPILER-360/main360/src/main/java/module-info.java b/src/it/MCOMPILER-360/main360/src/main/java/module-info.java index 084009f0..2ad68325 100644 --- a/src/it/MCOMPILER-360/main360/src/main/java/module-info.java +++ b/src/it/MCOMPILER-360/main360/src/main/java/module-info.java @@ -6,9 +6,9 @@ * 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 @@ -17,4 +17,5 @@ * under the License. */ -module org.maven.test.app {} +module org.maven.test.app { +} diff --git a/src/it/MCOMPILER-366/pom.xml b/src/it/MCOMPILER-366/pom.xml index cfc6b418..35444fcd 100644 --- a/src/it/MCOMPILER-366/pom.xml +++ b/src/it/MCOMPILER-366/pom.xml @@ -50,7 +50,7 @@ org.codehaus.plexus plexus-utils - 3.0.24 + 2.0.4 org.codehaus.plexus diff --git a/src/it/MCOMPILER-366/src/main/java/module-info.java b/src/it/MCOMPILER-366/src/main/java/module-info.java index 543dc053..95e72665 100644 --- a/src/it/MCOMPILER-366/src/main/java/module-info.java +++ b/src/it/MCOMPILER-366/src/main/java/module-info.java @@ -6,9 +6,9 @@ * 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 @@ -16,9 +16,9 @@ * specific language governing permissions and limitations * under the License. */ -module lib { +module lib +{ requires plexus.utils; requires plexus.resources; - exports org.maven.test; -} +} \ No newline at end of file diff --git a/src/it/MCOMPILER-366/src/main/java/org/maven/test/Main.java b/src/it/MCOMPILER-366/src/main/java/org/maven/test/Main.java index 833bee54..f2c4a2fa 100644 --- a/src/it/MCOMPILER-366/src/main/java/org/maven/test/Main.java +++ b/src/it/MCOMPILER-366/src/main/java/org/maven/test/Main.java @@ -1,3 +1,5 @@ +package org.maven.test; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,10 +18,9 @@ * specific language governing permissions and limitations * under the License. */ -package org.maven.test; -import org.codehaus.plexus.resource.ResourceManager; import org.codehaus.plexus.util.StringUtils; +import org.codehaus.plexus.resource.ResourceManager; public class Main { @@ -27,7 +28,7 @@ public class Main { * @param args */ public static void main(String[] args) { - System.out.println(StringUtils.concatenate(args)); + System.out.println( StringUtils.concatenate( args ) ); ResourceManager manager = null; } -} +} \ No newline at end of file diff --git a/src/it/MCOMPILER-366/verify.groovy b/src/it/MCOMPILER-366/verify.groovy index 19e525d3..c5a90ad5 100644 --- a/src/it/MCOMPILER-366/verify.groovy +++ b/src/it/MCOMPILER-366/verify.groovy @@ -19,4 +19,4 @@ buildLog = new File( basedir, 'build.log' ).text; -assert buildLog.contains("[WARNING] * Required filename-based automodules detected: [plexus-utils-3.0.24.jar, plexus-resources-1.1.0.jar]. Please don't publish this project to a public artifact repository! *"); +assert buildLog.contains("[WARNING] * Required filename-based automodules detected: [plexus-utils-2.0.4.jar, plexus-resources-1.1.0.jar]. Please don't publish this project to a public artifact repository! *"); 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 index 7360b4a5..03303316 100644 --- 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 @@ -1,3 +1,5 @@ +package org.maven.bug; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,10 +18,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.maven.bug; -public class A { - static int getCount() { +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 index aec29939..e30f7296 100644 --- 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 @@ -1,3 +1,5 @@ +package org.maven.bug; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,10 +18,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.maven.bug; -public class B { - static int getCount() { +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 index 1797e69e..8963f312 100644 --- 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 @@ -1,3 +1,5 @@ +package org.maven.bug; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,10 +18,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.maven.bug; -public class B { - int getCount() { +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 index 4b56281d..16fcc261 100644 --- 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 @@ -1,3 +1,5 @@ +package org.maven.bug; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,10 +18,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.maven.bug; -public class A9 { - static int getCount() { +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 index 1e54a47e..cfb033b6 100644 --- 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 @@ -1,3 +1,5 @@ +package org.maven.bug; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,10 +18,11 @@ * specific language governing permissions and limitations * under the License. */ -package org.maven.bug; -public class B { - static int getCount() { +public class B +{ + static int getCount() + { return A9.getCount() + 1; } } diff --git a/src/it/MCOMPILER-379/module2/src/main/java/com/natros/mcp/Foo.java b/src/it/MCOMPILER-379/module2/src/main/java/com/natros/mcp/Foo.java index c63e6e40..7e6d55c2 100644 --- a/src/it/MCOMPILER-379/module2/src/main/java/com/natros/mcp/Foo.java +++ b/src/it/MCOMPILER-379/module2/src/main/java/com/natros/mcp/Foo.java @@ -6,9 +6,9 @@ * 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 @@ -18,4 +18,5 @@ */ package com.natros.mcp; -public class Foo {} +public class Foo { +} diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-api/pom.xml b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-api/pom.xml deleted file mode 100644 index 0a0cb9e9..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-api/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - 4.0.0 - - - org.apache.maven.plugins.compiler.it - mcompiler391-test - 1.0.0-SNAPSHOT - - - mcompiler391-annotation-api - - diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-api/src/main/java/mcompiler391/SimpleAnnotation.java b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-api/src/main/java/mcompiler391/SimpleAnnotation.java deleted file mode 100644 index 849478d4..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-api/src/main/java/mcompiler391/SimpleAnnotation.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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. - */ -package mcompiler391; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.SOURCE) -public @interface SimpleAnnotation { - /** - * Specifies which class (FQCN) is supposed to be on classpath during annotation processing. - * Used to check if the dependency resolution mechanism of maven-compiler-plugin is constructing - * the classpath (processorpath) correctly, based on the plugin configuration and dependency management. - */ - String onClasspath() default ""; -} diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor-dep-v1/pom.xml b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor-dep-v1/pom.xml deleted file mode 100644 index 7e4b5821..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor-dep-v1/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - 4.0.0 - - - org.apache.maven.plugins.compiler.it - mcompiler391-test - 1.0.0-SNAPSHOT - - - mcompiler391-annotation-processor-dep - - diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor-dep-v1/src/main/java/mcompiler391/AnnotationProcessorDependencyV1.java b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor-dep-v1/src/main/java/mcompiler391/AnnotationProcessorDependencyV1.java deleted file mode 100644 index 0370df95..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor-dep-v1/src/main/java/mcompiler391/AnnotationProcessorDependencyV1.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ -package mcompiler391; - -public class AnnotationProcessorDependencyV1 {} diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor-dep-v2/pom.xml b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor-dep-v2/pom.xml deleted file mode 100644 index f1e16a01..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor-dep-v2/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - 4.0.0 - - - org.apache.maven.plugins.compiler.it - mcompiler391-test - 1.0.0-SNAPSHOT - - - - mcompiler391-annotation-processor-dep - 2.0.0-SNAPSHOT - - diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor-dep-v2/src/main/java/mcompiler391/AnnotationProcessorDependencyV2.java b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor-dep-v2/src/main/java/mcompiler391/AnnotationProcessorDependencyV2.java deleted file mode 100644 index e3c7879c..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor-dep-v2/src/main/java/mcompiler391/AnnotationProcessorDependencyV2.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ -package mcompiler391; - -public class AnnotationProcessorDependencyV2 {} diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor/pom.xml b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor/pom.xml deleted file mode 100644 index 5fff8746..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - 4.0.0 - - - org.apache.maven.plugins.compiler.it - mcompiler391-test - 1.0.0-SNAPSHOT - - - mcompiler391-annotation-processor - - - - org.apache.maven.plugins.compiler.it - mcompiler391-annotation-api - 1.0.0-SNAPSHOT - - - org.apache.maven.plugins.compiler.it - mcompiler391-annotation-processor-dep - 1.0.0-SNAPSHOT - - - - diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor/src/main/java/mcompiler391/SimpleAnnotationProcessor.java b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor/src/main/java/mcompiler391/SimpleAnnotationProcessor.java deleted file mode 100644 index 9ff0f704..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-processor/src/main/java/mcompiler391/SimpleAnnotationProcessor.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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. - */ -package mcompiler391; - -import javax.annotation.processing.AbstractProcessor; -import javax.annotation.processing.Filer; -import javax.annotation.processing.RoundEnvironment; -import javax.annotation.processing.SupportedAnnotationTypes; -import javax.annotation.processing.SupportedSourceVersion; -import javax.lang.model.SourceVersion; -import javax.lang.model.element.Element; -import javax.lang.model.element.Name; -import javax.lang.model.element.PackageElement; -import javax.lang.model.element.TypeElement; -import javax.lang.model.util.Elements; -import javax.tools.FileObject; -import javax.tools.StandardLocation; - -import java.io.IOException; -import java.io.Writer; -import java.util.Set; - -@SupportedSourceVersion(SourceVersion.RELEASE_6) -@SupportedAnnotationTypes("mcompiler391.SimpleAnnotation") -public class SimpleAnnotationProcessor extends AbstractProcessor { - - @Override - public boolean process(Set annotations, RoundEnvironment roundEnv) { - if (annotations.isEmpty()) { - return true; - } - - Filer filer = processingEnv.getFiler(); - - Elements elementUtils = processingEnv.getElementUtils(); - - Set elements = - roundEnv.getElementsAnnotatedWith(annotations.iterator().next()); - - for (Element element : elements) { - Name name = element.getSimpleName(); - PackageElement packageElement = elementUtils.getPackageOf(element); - - SimpleAnnotation annotation = element.getAnnotation(SimpleAnnotation.class); - assertThatClassIsOnClasspath(annotation.onClasspath()); - - try { - Name packageName = packageElement.getQualifiedName(); - FileObject resource = - filer.createResource(StandardLocation.SOURCE_OUTPUT, packageName, name + ".txt", element); - - Writer writer = resource.openWriter(); - writer.write(name.toString()); - writer.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - return !elements.isEmpty(); - } - - private void assertThatClassIsOnClasspath(String fqcn) { - try { - getClass().getClassLoader().loadClass(fqcn); - } catch (ClassNotFoundException cnfe) { - String msg = - String.format("Expected class '%s' to be on the classpath (processorpath), but it wasn't.", fqcn); - throw new RuntimeException(msg, cnfe); - } - } -} diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user1/pom.xml b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user1/pom.xml deleted file mode 100644 index 5eab1425..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user1/pom.xml +++ /dev/null @@ -1,89 +0,0 @@ - - - - - 4.0.0 - - - org.apache.maven.plugins.compiler.it - mcompiler391-test - 1.0.0-SNAPSHOT - - - mcompiler391-annotation-user1 - Annotation processor version from depMgmt + useDepMgmt=false - - - - - org.apache.maven.plugins.compiler.it - mcompiler391-annotation-processor - 1.0.0-SNAPSHOT - - - - - - - org.apache.maven.plugins.compiler.it - mcompiler391-annotation-api - 1.0.0-SNAPSHOT - - - - - - - maven-compiler-plugin - - - mcompiler391.SimpleAnnotationProcessor - - - - org.apache.maven.plugins.compiler.it - mcompiler391-annotation-processor - - - - - - org.apache.maven.plugins.compiler.it - annotation-verify-plugin - 1.0.0-SNAPSHOT - - - verify-annotations - process-test-classes - - read-source - - - mcompiler391.SimpleObject1 - mcompiler391.SimpleTestObject1 - - - - - - - diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user1/src/main/java/mcompiler391/SimpleObject1.java b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user1/src/main/java/mcompiler391/SimpleObject1.java deleted file mode 100644 index 8bd8a0e4..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user1/src/main/java/mcompiler391/SimpleObject1.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ -package mcompiler391; - -@SimpleAnnotation(onClasspath = "mcompiler391.AnnotationProcessorDependencyV1") -public class SimpleObject1 {} diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user1/src/test/java/mcompiler391/SimpleTestObject1.java b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user1/src/test/java/mcompiler391/SimpleTestObject1.java deleted file mode 100644 index d8592118..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user1/src/test/java/mcompiler391/SimpleTestObject1.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ -package mcompiler391; - -@SimpleAnnotation(onClasspath = "mcompiler391.AnnotationProcessorDependencyV1") -public class SimpleTestObject1 {} diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user2/pom.xml b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user2/pom.xml deleted file mode 100644 index 56958dec..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user2/pom.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - 4.0.0 - - - org.apache.maven.plugins.compiler.it - mcompiler391-test - 1.0.0-SNAPSHOT - - - mcompiler391-annotation-user2 - Annotation processor version from depMgmt + useDepMgmt=true - - - - org.apache.maven.plugins.compiler.it - mcompiler391-annotation-api - 1.0.0-SNAPSHOT - - - - - - - org.apache.maven.plugins.compiler.it - mcompiler391-annotation-processor - 1.0.0-SNAPSHOT - - - - org.apache.maven.plugins.compiler.it - mcompiler391-annotation-processor-dep - 2.0.0-SNAPSHOT - - - - - - - - maven-compiler-plugin - - - mcompiler391.SimpleAnnotationProcessor - - true - - - org.apache.maven.plugins.compiler.it - mcompiler391-annotation-processor - - - - - - org.apache.maven.plugins.compiler.it - annotation-verify-plugin - 1.0.0-SNAPSHOT - - - verify-annotations - process-test-classes - - read-source - - - mcompiler391.SimpleObject2 - mcompiler391.SimpleTestObject2 - - - - - - - diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user2/src/main/java/mcompiler391/SimpleObject2.java b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user2/src/main/java/mcompiler391/SimpleObject2.java deleted file mode 100644 index 35072a3d..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user2/src/main/java/mcompiler391/SimpleObject2.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ -package mcompiler391; - -@SimpleAnnotation(onClasspath = "mcompiler391.AnnotationProcessorDependencyV2") -public class SimpleObject2 {} diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user2/src/test/java/mcompiler391/SimpleTestObject2.java b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user2/src/test/java/mcompiler391/SimpleTestObject2.java deleted file mode 100644 index fc006907..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user2/src/test/java/mcompiler391/SimpleTestObject2.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ -package mcompiler391; - -@SimpleAnnotation(onClasspath = "mcompiler391.AnnotationProcessorDependencyV2") -public class SimpleTestObject2 {} diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user3/pom.xml b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user3/pom.xml deleted file mode 100644 index 55b44c10..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user3/pom.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - 4.0.0 - - - org.apache.maven.plugins.compiler.it - mcompiler391-test - 1.0.0-SNAPSHOT - - - mcompiler391-annotation-user3 - Annotation processor version explicitly set + useDepMgmt=false - - - - org.apache.maven.plugins.compiler.it - mcompiler391-annotation-api - 1.0.0-SNAPSHOT - - - - - - - maven-compiler-plugin - - - mcompiler391.SimpleAnnotationProcessor - - - - org.apache.maven.plugins.compiler.it - mcompiler391-annotation-processor - 1.0.0-SNAPSHOT - - - - - - org.apache.maven.plugins.compiler.it - annotation-verify-plugin - 1.0.0-SNAPSHOT - - - verify-annotations - process-test-classes - - read-source - - - mcompiler391.SimpleObject3 - mcompiler391.SimpleTestObject3 - - - - - - - diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user3/src/main/java/mcompiler391/SimpleObject3.java b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user3/src/main/java/mcompiler391/SimpleObject3.java deleted file mode 100644 index 9334f44c..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user3/src/main/java/mcompiler391/SimpleObject3.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ -package mcompiler391; - -@SimpleAnnotation(onClasspath = "mcompiler391.AnnotationProcessorDependencyV1") -public class SimpleObject3 {} diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user3/src/test/java/mcompiler391/SimpleTestObject3.java b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user3/src/test/java/mcompiler391/SimpleTestObject3.java deleted file mode 100644 index 9f3510cf..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user3/src/test/java/mcompiler391/SimpleTestObject3.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ -package mcompiler391; - -@SimpleAnnotation(onClasspath = "mcompiler391.AnnotationProcessorDependencyV1") -public class SimpleTestObject3 {} diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user4/pom.xml b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user4/pom.xml deleted file mode 100644 index d4fb7dae..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user4/pom.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - 4.0.0 - - - org.apache.maven.plugins.compiler.it - mcompiler391-test - 1.0.0-SNAPSHOT - - - mcompiler391-annotation-user4 - Annotation processor version explicitly set + useDepMgmt=true - - - - org.apache.maven.plugins.compiler.it - mcompiler391-annotation-api - 1.0.0-SNAPSHOT - - - - - - - - org.apache.maven.plugins.compiler.it - mcompiler391-annotation-processor-dep - 2.0.0-SNAPSHOT - - - - - - - - maven-compiler-plugin - - - mcompiler391.SimpleAnnotationProcessor - - true - - - org.apache.maven.plugins.compiler.it - mcompiler391-annotation-processor - 1.0.0-SNAPSHOT - - - - - - org.apache.maven.plugins.compiler.it - annotation-verify-plugin - 1.0.0-SNAPSHOT - - - verify-annotations - process-test-classes - - read-source - - - mcompiler391.SimpleObject4 - mcompiler391.SimpleTestObject4 - - - - - - - diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user4/src/main/java/mcompiler391/SimpleObject4.java b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user4/src/main/java/mcompiler391/SimpleObject4.java deleted file mode 100644 index baa0c782..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user4/src/main/java/mcompiler391/SimpleObject4.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ -package mcompiler391; - -@SimpleAnnotation(onClasspath = "mcompiler391.AnnotationProcessorDependencyV2") -public class SimpleObject4 {} diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user4/src/test/java/mcompiler391/SimpleTestObject4.java b/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user4/src/test/java/mcompiler391/SimpleTestObject4.java deleted file mode 100644 index 657b1b30..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/annotation-user4/src/test/java/mcompiler391/SimpleTestObject4.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ -package mcompiler391; - -@SimpleAnnotation(onClasspath = "mcompiler391.AnnotationProcessorDependencyV2") -public class SimpleTestObject4 {} diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/invoker.properties b/src/it/MCOMPILER-391-processorpath-dep-mgmt/invoker.properties deleted file mode 100644 index a0a3964f..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/invoker.properties +++ /dev/null @@ -1,18 +0,0 @@ -# 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=process-test-classes diff --git a/src/it/MCOMPILER-391-processorpath-dep-mgmt/pom.xml b/src/it/MCOMPILER-391-processorpath-dep-mgmt/pom.xml deleted file mode 100644 index 761081bd..00000000 --- a/src/it/MCOMPILER-391-processorpath-dep-mgmt/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - 4.0.0 - - org.apache.maven.plugins.compiler.it - mcompiler391-test - 1.0.0-SNAPSHOT - pom - - https://issues.apache.org/jira/browse/MCOMPILER-391 - - - annotation-api - annotation-processor-dep-v1 - annotation-processor-dep-v2 - annotation-processor - annotation-user1 - annotation-user2 - annotation-user3 - annotation-user4 - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - @project.version@ - - - - - - diff --git a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-processor-dep/pom.xml b/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-processor-dep/pom.xml deleted file mode 100644 index 0c6da32d..00000000 --- a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-processor-dep/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - 4.0.0 - - - org.apache.maven.plugins.compiler.it - mcompiler395-test - 1.0.0-SNAPSHOT - - - mcompiler395-annotation-processor-dep - - diff --git a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-processor-dep/src/main/java/mcompiler395/AnnotationProcessorDependency.java b/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-processor-dep/src/main/java/mcompiler395/AnnotationProcessorDependency.java deleted file mode 100644 index 001845b8..00000000 --- a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-processor-dep/src/main/java/mcompiler395/AnnotationProcessorDependency.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ -package mcompiler395; - -public class AnnotationProcessorDependency {} diff --git a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-processor/pom.xml b/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-processor/pom.xml deleted file mode 100644 index b180db0c..00000000 --- a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-processor/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - 4.0.0 - - - org.apache.maven.plugins.compiler.it - mcompiler395-test - 1.0.0-SNAPSHOT - - - mcompiler395-annotation-processor - - - - org.apache.maven.plugins.compiler.it - mcompiler395-annotation-processor-dep - 1.0.0-SNAPSHOT - - - diff --git a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-processor/src/main/java/mcompiler395/SimpleAnnotationProcessor.java b/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-processor/src/main/java/mcompiler395/SimpleAnnotationProcessor.java deleted file mode 100644 index 9ee6229e..00000000 --- a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-processor/src/main/java/mcompiler395/SimpleAnnotationProcessor.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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. - */ -package mcompiler395; - -import javax.annotation.processing.AbstractProcessor; -import javax.annotation.processing.Filer; -import javax.annotation.processing.RoundEnvironment; -import javax.annotation.processing.SupportedAnnotationTypes; -import javax.annotation.processing.SupportedSourceVersion; -import javax.lang.model.SourceVersion; -import javax.lang.model.element.Element; -import javax.lang.model.element.Name; -import javax.lang.model.element.PackageElement; -import javax.lang.model.element.TypeElement; -import javax.lang.model.util.Elements; -import javax.tools.FileObject; -import javax.tools.StandardLocation; - -import java.io.IOException; -import java.io.Writer; -import java.util.Set; - -@SupportedSourceVersion(SourceVersion.RELEASE_6) -@SupportedAnnotationTypes("mcompiler395.SimpleAnnotation") -public class SimpleAnnotationProcessor extends AbstractProcessor { - - @Override - public boolean process(Set annotations, RoundEnvironment roundEnv) { - if (annotations.isEmpty()) { - return true; - } - - // assert that mcompiler395-annotation-processor-dep is NOT on the processorpath, since it is excluded - // in the plugin configuration - try { - getClass().getClassLoader().loadClass("mcompiler395.AnnotationProcessorDependency"); - throw new RuntimeException("Expected a ClassNotFoundException, because " - + "mcompiler395.AnnotationProcessorDependency is not supposed to be on the processorpath."); - } catch (ClassNotFoundException expected) { - // expected - } - - Filer filer = processingEnv.getFiler(); - - Elements elementUtils = processingEnv.getElementUtils(); - - Set elements = - roundEnv.getElementsAnnotatedWith(annotations.iterator().next()); - - for (Element element : elements) { - Name name = element.getSimpleName(); - - PackageElement packageElement = elementUtils.getPackageOf(element); - - try { - Name packageName = packageElement.getQualifiedName(); - FileObject resource = - filer.createResource(StandardLocation.SOURCE_OUTPUT, packageName, name + ".txt", element); - - Writer writer = resource.openWriter(); - writer.write(name.toString()); - writer.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - return !elements.isEmpty(); - } -} diff --git a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-user/pom.xml b/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-user/pom.xml deleted file mode 100644 index b5e40524..00000000 --- a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-user/pom.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - 4.0.0 - - - org.apache.maven.plugins.compiler.it - mcompiler395-test - 1.0.0-SNAPSHOT - - - mcompiler395-annotation-user - - - - - maven-compiler-plugin - - - mcompiler395.SimpleAnnotationProcessor - - - - org.apache.maven.plugins.compiler.it - mcompiler395-annotation-processor - 1.0.0-SNAPSHOT - - - org.apache.maven.plugins.compiler.it - mcompiler395-annotation-processor-dep - - - - - - - - org.apache.maven.plugins.compiler.it - annotation-verify-plugin - 1.0.0-SNAPSHOT - - - verify-annotations - process-test-classes - - read-source - - - mcompiler395.SimpleObject - mcompiler395.SimpleTestObject - - - - - - - diff --git a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-user/src/main/java/mcompiler395/SimpleAnnotation.java b/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-user/src/main/java/mcompiler395/SimpleAnnotation.java deleted file mode 100644 index 361cfefa..00000000 --- a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-user/src/main/java/mcompiler395/SimpleAnnotation.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ -package mcompiler395; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.SOURCE) -public @interface SimpleAnnotation {} diff --git a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-user/src/main/java/mcompiler395/SimpleObject.java b/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-user/src/main/java/mcompiler395/SimpleObject.java deleted file mode 100644 index 60cee1ef..00000000 --- a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-user/src/main/java/mcompiler395/SimpleObject.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ -package mcompiler395; - -@SimpleAnnotation -public class SimpleObject {} diff --git a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-user/src/test/java/mcompiler395/SimpleTestObject.java b/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-user/src/test/java/mcompiler395/SimpleTestObject.java deleted file mode 100644 index 15d51903..00000000 --- a/src/it/MCOMPILER-395-processorpath-exclude-deps/annotation-user/src/test/java/mcompiler395/SimpleTestObject.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ -package mcompiler395; - -@SimpleAnnotation -public class SimpleTestObject {} diff --git a/src/it/MCOMPILER-395-processorpath-exclude-deps/invoker.properties b/src/it/MCOMPILER-395-processorpath-exclude-deps/invoker.properties deleted file mode 100644 index a0a3964f..00000000 --- a/src/it/MCOMPILER-395-processorpath-exclude-deps/invoker.properties +++ /dev/null @@ -1,18 +0,0 @@ -# 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=process-test-classes diff --git a/src/it/MCOMPILER-395-processorpath-exclude-deps/pom.xml b/src/it/MCOMPILER-395-processorpath-exclude-deps/pom.xml deleted file mode 100644 index cf9dec7b..00000000 --- a/src/it/MCOMPILER-395-processorpath-exclude-deps/pom.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - 4.0.0 - - org.apache.maven.plugins.compiler.it - mcompiler395-test - 1.0.0-SNAPSHOT - pom - - - annotation-processor-dep - annotation-processor - annotation-user - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - @project.version@ - - - - - diff --git a/src/it/MCOMPILER-474_recompile-dependent-when-package/dependent-module/src/main/java/Main.java b/src/it/MCOMPILER-474_recompile-dependent-when-package/dependent-module/src/main/java/Main.java index 3f50a05e..dbad7cf7 100644 --- a/src/it/MCOMPILER-474_recompile-dependent-when-package/dependent-module/src/main/java/Main.java +++ b/src/it/MCOMPILER-474_recompile-dependent-when-package/dependent-module/src/main/java/Main.java @@ -16,10 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class Main { - public static void main(String[] args) { +public class Main +{ + public static void main( String[] args ) + { TestService testService = new TestService(); testService.run(); } diff --git a/src/it/MCOMPILER-474_recompile-dependent-when-package/service/src/main/java/TestService.java b/src/it/MCOMPILER-474_recompile-dependent-when-package/service/src/main/java/TestService.java index 08e2016a..7d5e8787 100644 --- a/src/it/MCOMPILER-474_recompile-dependent-when-package/service/src/main/java/TestService.java +++ b/src/it/MCOMPILER-474_recompile-dependent-when-package/service/src/main/java/TestService.java @@ -16,9 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class TestService { +public class TestService +{ - public void run() {} + public void run() + { + + } } diff --git a/src/it/MCOMPILER-474_recompile-dependent-when-package/verify.groovy b/src/it/MCOMPILER-474_recompile-dependent-when-package/verify.groovy index e32f7a63..11789f72 100644 --- a/src/it/MCOMPILER-474_recompile-dependent-when-package/verify.groovy +++ b/src/it/MCOMPILER-474_recompile-dependent-when-package/verify.groovy @@ -1,3 +1,4 @@ + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/src/it/MCOMPILER-481-requires-static-included/app/src/main/java/org/test/app/Main.java b/src/it/MCOMPILER-481-requires-static-included/app/src/main/java/org/test/app/Main.java index 631169b8..6debb0cf 100644 --- a/src/it/MCOMPILER-481-requires-static-included/app/src/main/java/org/test/app/Main.java +++ b/src/it/MCOMPILER-481-requires-static-included/app/src/main/java/org/test/app/Main.java @@ -1,3 +1,5 @@ +package org.test.app; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,6 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.test.app; -public class Main {} +public class Main +{ +} diff --git a/src/it/MCOMPILER-481-requires-static-included/app/src/test/java/org/test/app/MainTest.java b/src/it/MCOMPILER-481-requires-static-included/app/src/test/java/org/test/app/MainTest.java index 216b3a9a..9c220a88 100644 --- a/src/it/MCOMPILER-481-requires-static-included/app/src/test/java/org/test/app/MainTest.java +++ b/src/it/MCOMPILER-481-requires-static-included/app/src/test/java/org/test/app/MainTest.java @@ -1,3 +1,5 @@ +package org.test.app; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,15 +18,16 @@ * specific language governing permissions and limitations * under the License. */ -package org.test.app; import org.eclipse.jetty.util.ajax.JSON; import org.junit.jupiter.api.Test; import org.test.service.JSONService; -public class MainTest { +public class MainTest +{ @Test - public void test() { + public void test() + { JSON json = new JSONService().json; System.err.println("json = " + json); } diff --git a/src/it/MCOMPILER-481-requires-static-included/pom.xml b/src/it/MCOMPILER-481-requires-static-included/pom.xml index 5bcd1bcb..489b17a9 100644 --- a/src/it/MCOMPILER-481-requires-static-included/pom.xml +++ b/src/it/MCOMPILER-481-requires-static-included/pom.xml @@ -49,7 +49,6 @@ under the License. - org.apache.maven.plugins maven-surefire-plugin 2.22.2 diff --git a/src/it/MCOMPILER-481-requires-static-included/service/src/main/java/org/test/service/JSONService.java b/src/it/MCOMPILER-481-requires-static-included/service/src/main/java/org/test/service/JSONService.java index 022fd19a..0bca3de1 100644 --- a/src/it/MCOMPILER-481-requires-static-included/service/src/main/java/org/test/service/JSONService.java +++ b/src/it/MCOMPILER-481-requires-static-included/service/src/main/java/org/test/service/JSONService.java @@ -1,3 +1,5 @@ +package org.test.service; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,10 +18,10 @@ * specific language governing permissions and limitations * under the License. */ -package org.test.service; import org.eclipse.jetty.util.ajax.JSON; -public class JSONService extends Service { +public class JSONService extends Service +{ public final JSON json = new JSON(); } diff --git a/src/it/MCOMPILER-481-requires-static-included/service/src/main/java/org/test/service/Service.java b/src/it/MCOMPILER-481-requires-static-included/service/src/main/java/org/test/service/Service.java index 7bd21cf5..69b865f1 100644 --- a/src/it/MCOMPILER-481-requires-static-included/service/src/main/java/org/test/service/Service.java +++ b/src/it/MCOMPILER-481-requires-static-included/service/src/main/java/org/test/service/Service.java @@ -1,3 +1,5 @@ +package org.test.service; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,6 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.test.service; -public abstract class Service {} +public abstract class Service +{ +} diff --git a/src/it/MCOMPILER-485/src/main/java/dummy/HelloWorld.java b/src/it/MCOMPILER-485/src/main/java/dummy/HelloWorld.java index 7ceb91cb..cda1006a 100644 --- a/src/it/MCOMPILER-485/src/main/java/dummy/HelloWorld.java +++ b/src/it/MCOMPILER-485/src/main/java/dummy/HelloWorld.java @@ -1,3 +1,5 @@ +package dummy; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,10 +18,11 @@ * specific language governing permissions and limitations * under the License. */ -package dummy; -public class HelloWorld { - public static void main(String[] argv) { - System.out.println("Hello World"); - } + +public class HelloWorld +{ + public static void main(String[] argv) { + System.out.println("Hello World"); + } } diff --git a/src/it/MCOMPILER-485/src/main/java/dummy/package-info.java b/src/it/MCOMPILER-485/src/main/java/dummy/package-info.java index 9d2deff2..ed72542b 100644 --- a/src/it/MCOMPILER-485/src/main/java/dummy/package-info.java +++ b/src/it/MCOMPILER-485/src/main/java/dummy/package-info.java @@ -20,4 +20,4 @@ /** * This is the package javadoc */ -package dummy; +package dummy; \ No newline at end of file diff --git a/src/it/MCOMPILER-485/verify.groovy b/src/it/MCOMPILER-485/verify.groovy index d8ccdafe..2384fecd 100644 --- a/src/it/MCOMPILER-485/verify.groovy +++ b/src/it/MCOMPILER-485/verify.groovy @@ -1,3 +1,4 @@ + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/src/it/MCOMPILER-495/src/main/java/dummy/package-info.java b/src/it/MCOMPILER-495/src/main/java/dummy/package-info.java index 9d2deff2..ed72542b 100644 --- a/src/it/MCOMPILER-495/src/main/java/dummy/package-info.java +++ b/src/it/MCOMPILER-495/src/main/java/dummy/package-info.java @@ -20,4 +20,4 @@ /** * This is the package javadoc */ -package dummy; +package dummy; \ No newline at end of file diff --git a/src/it/MCOMPILER-495/verify.groovy b/src/it/MCOMPILER-495/verify.groovy index d8ccdafe..2384fecd 100644 --- a/src/it/MCOMPILER-495/verify.groovy +++ b/src/it/MCOMPILER-495/verify.groovy @@ -1,3 +1,4 @@ + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/src/it/MCOMPILER-500-package-info-incr/pom.xml b/src/it/MCOMPILER-500-package-info-incr/pom.xml index c79c3f9a..e50782c1 100644 --- a/src/it/MCOMPILER-500-package-info-incr/pom.xml +++ b/src/it/MCOMPILER-500-package-info-incr/pom.xml @@ -31,6 +31,8 @@ under the License. UTF-8 + 8 + 8 diff --git a/src/it/MCOMPILER-500-package-info-incr/src/main/java/dummy/Person.java b/src/it/MCOMPILER-500-package-info-incr/src/main/java/dummy/Person.java index f07d0f37..e5fbf583 100644 --- a/src/it/MCOMPILER-500-package-info-incr/src/main/java/dummy/Person.java +++ b/src/it/MCOMPILER-500-package-info-incr/src/main/java/dummy/Person.java @@ -1,3 +1,5 @@ +package dummy; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package dummy; + public class Person { private long id; diff --git a/src/it/MCOMPILER-500-package-info-incr/src/main/java/dummy/foo/Person.java b/src/it/MCOMPILER-500-package-info-incr/src/main/java/dummy/foo/Person.java index 15d396d1..9b56c1d6 100644 --- a/src/it/MCOMPILER-500-package-info-incr/src/main/java/dummy/foo/Person.java +++ b/src/it/MCOMPILER-500-package-info-incr/src/main/java/dummy/foo/Person.java @@ -1,3 +1,5 @@ +package dummy.foo; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package dummy.foo; + public class Person { private long id; diff --git a/src/it/MCOMPILER-500-package-info-incr/src/main/java/dummy/package-info.java b/src/it/MCOMPILER-500-package-info-incr/src/main/java/dummy/package-info.java index 9d2deff2..ed72542b 100644 --- a/src/it/MCOMPILER-500-package-info-incr/src/main/java/dummy/package-info.java +++ b/src/it/MCOMPILER-500-package-info-incr/src/main/java/dummy/package-info.java @@ -20,4 +20,4 @@ /** * This is the package javadoc */ -package dummy; +package dummy; \ No newline at end of file diff --git a/src/it/MCOMPILER-500-package-info-incr/verify.groovy b/src/it/MCOMPILER-500-package-info-incr/verify.groovy index ccfebf3f..98195272 100644 --- a/src/it/MCOMPILER-500-package-info-incr/verify.groovy +++ b/src/it/MCOMPILER-500-package-info-incr/verify.groovy @@ -1,3 +1,4 @@ + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -20,7 +21,7 @@ def logFile = new File( basedir, 'build.log' ) assert logFile.exists() content = logFile.text -assert 1 == content.count( "Recompiling the module because of ") -assert 1 == content.count( 'Nothing to compile - all classes are up to date.' ) +assert 1 == content.count( 'Recompiling the module because of changed source code.' ) +assert 1 == content.count( 'Nothing to compile - all classes are up to date' ) diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v1/pom.xml b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v1/pom.xml deleted file mode 100644 index 6f87e713..00000000 --- a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v1/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - 4.0.0 - - - org.apache.maven.plugins.compiler.it - mcompiler503-test - 1.0.0-SNAPSHOT - - - mcompiler503-annotation-processor-dep - - diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v1/src/main/java/mcompiler503/AnnotationProcessorDependencyV1.java b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v1/src/main/java/mcompiler503/AnnotationProcessorDependencyV1.java deleted file mode 100644 index 35fe82b1..00000000 --- a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v1/src/main/java/mcompiler503/AnnotationProcessorDependencyV1.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ -package mcompiler503; - -public class AnnotationProcessorDependencyV1 {} diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v2/pom.xml b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v2/pom.xml deleted file mode 100644 index d363bd2d..00000000 --- a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v2/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - 4.0.0 - - - org.apache.maven.plugins.compiler.it - mcompiler503-test - 1.0.0-SNAPSHOT - - - mcompiler503-annotation-processor-dep - 2.0.0-SNAPSHOT - - diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v2/src/main/java/mcompiler503/AnnotationProcessorDependencyV2.java b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v2/src/main/java/mcompiler503/AnnotationProcessorDependencyV2.java deleted file mode 100644 index 08c5067d..00000000 --- a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor-dep-v2/src/main/java/mcompiler503/AnnotationProcessorDependencyV2.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ -package mcompiler503; - -public class AnnotationProcessorDependencyV2 {} diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor/pom.xml b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor/pom.xml deleted file mode 100644 index ed0e4906..00000000 --- a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor/pom.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - 4.0.0 - - - org.apache.maven.plugins.compiler.it - mcompiler503-test - 1.0.0-SNAPSHOT - - - mcompiler503-annotation-processor - - - - org.apache.maven.plugins.compiler.it - mcompiler503-annotation-processor-dep - 1.0.0-SNAPSHOT - - - diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor/src/main/java/mcompiler503/SimpleAnnotationProcessor.java b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor/src/main/java/mcompiler503/SimpleAnnotationProcessor.java deleted file mode 100644 index 74c44a4b..00000000 --- a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-processor/src/main/java/mcompiler503/SimpleAnnotationProcessor.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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. - */ -package mcompiler503; - -import javax.annotation.processing.AbstractProcessor; -import javax.annotation.processing.Filer; -import javax.annotation.processing.RoundEnvironment; -import javax.annotation.processing.SupportedAnnotationTypes; -import javax.annotation.processing.SupportedSourceVersion; -import javax.lang.model.SourceVersion; -import javax.lang.model.element.Element; -import javax.lang.model.element.Name; -import javax.lang.model.element.PackageElement; -import javax.lang.model.element.TypeElement; -import javax.lang.model.util.Elements; -import javax.tools.FileObject; -import javax.tools.JavaFileObject; -import javax.tools.StandardLocation; - -import java.io.IOException; -import java.io.Writer; -import java.util.Set; - -@SupportedSourceVersion(SourceVersion.RELEASE_6) -@SupportedAnnotationTypes("mcompiler503.SimpleAnnotation") -public class SimpleAnnotationProcessor extends AbstractProcessor { - - @Override - public boolean process(Set annotations, RoundEnvironment roundEnv) { - if (annotations.isEmpty()) { - return true; - } - - // assert that mcompiler503-annotation-processor-dep:2.0.0-SNAPSHOT is on the classpath - try { - getClass().getClassLoader().loadClass("mcompiler503.AnnotationProcessorDependencyV2"); - } catch (ClassNotFoundException expected) { - throw new RuntimeException("Expected mcompiler503.AnnotationProcessorDependencyV2 to be on the" - + "processorpath, because mcompiler503-annotation-processor-dep:2.0.0-SNAPSHOT is specifically" - + "configured as one the elements of the processorpath."); - } - - // assert that mcompiler503-annotation-processor-dep:1.0.0-SNAPSHOT is NOT on the classpath, - // since it should be replaced by mcompiler503-annotation-processor-dep:2.0.0-SNAPSHOT - // when resolving annotation processors and their dependencies - try { - getClass().getClassLoader().loadClass("mcompiler503.AnnotationProcessorDependencyV1"); - throw new RuntimeException("Expected a ClassNotFoundException, because " - + "mcompiler503.AnnotationProcessorDependencyV1 is not supposed to be on the processorpath."); - } catch (ClassNotFoundException expected) { - // expected. - } - - Filer filer = processingEnv.getFiler(); - - Elements elementUtils = processingEnv.getElementUtils(); - - Set elements = - roundEnv.getElementsAnnotatedWith(annotations.iterator().next()); - - for (Element element : elements) { - Name name = element.getSimpleName(); - - PackageElement packageElement = elementUtils.getPackageOf(element); - - try { - Name packageName = packageElement.getQualifiedName(); - FileObject resource = - filer.createResource(StandardLocation.SOURCE_OUTPUT, packageName, name + ".txt", element); - - Writer writer = resource.openWriter(); - writer.write(name.toString()); - writer.close(); - - String className = name + "Companion"; - JavaFileObject javaFile = filer.createSourceFile(packageName + "." + className, element); - - Writer javaWriter = javaFile.openWriter(); - javaWriter.append("package ").append(packageName).append(";\n\n"); - javaWriter.append("public class ").append(className).append(" {\n"); - javaWriter.append(" public ").append(className).append("() {\n"); - javaWriter.append(" System.out.println(\"Hey there!\");\n"); - javaWriter.append(" }\n}\n"); - javaWriter.close(); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - return !elements.isEmpty(); - } -} diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/pom.xml b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/pom.xml deleted file mode 100644 index 111eca20..00000000 --- a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - 4.0.0 - - - org.apache.maven.plugins.compiler.it - mcompiler503-test - 1.0.0-SNAPSHOT - - - mcompiler503-annotation-user - - - - - maven-compiler-plugin - - - mcompiler503.SimpleAnnotationProcessor - - - - org.apache.maven.plugins.compiler.it - mcompiler503-annotation-processor - 1.0.0-SNAPSHOT - - - - org.apache.maven.plugins.compiler.it - mcompiler503-annotation-processor-dep - 2.0.0-SNAPSHOT - - - - - - org.apache.maven.plugins.compiler.it - annotation-verify-plugin - 1.0.0-SNAPSHOT - - - verify-annotations - process-test-classes - - read-source - - - mcompiler503.SimpleObject - mcompiler503.SimpleTestObject - - - - - - - diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/main/java/mcompiler503/SimpleAnnotation.java b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/main/java/mcompiler503/SimpleAnnotation.java deleted file mode 100644 index 40846cd5..00000000 --- a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/main/java/mcompiler503/SimpleAnnotation.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ -package mcompiler503; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.SOURCE) -public @interface SimpleAnnotation {} diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/main/java/mcompiler503/SimpleObject.java b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/main/java/mcompiler503/SimpleObject.java deleted file mode 100644 index 954d70e6..00000000 --- a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/main/java/mcompiler503/SimpleObject.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ -package mcompiler503; - -@SimpleAnnotation -public class SimpleObject {} diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/test/java/mcompiler503/SimpleTestObject.java b/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/test/java/mcompiler503/SimpleTestObject.java deleted file mode 100644 index 43640f43..00000000 --- a/src/it/MCOMPILER-503-processorpath-duplicated-deps/annotation-user/src/test/java/mcompiler503/SimpleTestObject.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ -package mcompiler503; - -@SimpleAnnotation -public class SimpleTestObject {} diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/invoker.properties b/src/it/MCOMPILER-503-processorpath-duplicated-deps/invoker.properties deleted file mode 100644 index a0a3964f..00000000 --- a/src/it/MCOMPILER-503-processorpath-duplicated-deps/invoker.properties +++ /dev/null @@ -1,18 +0,0 @@ -# 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=process-test-classes diff --git a/src/it/MCOMPILER-503-processorpath-duplicated-deps/pom.xml b/src/it/MCOMPILER-503-processorpath-duplicated-deps/pom.xml deleted file mode 100644 index 85fd2baf..00000000 --- a/src/it/MCOMPILER-503-processorpath-duplicated-deps/pom.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - 4.0.0 - - org.apache.maven.plugins.compiler.it - mcompiler503-test - 1.0.0-SNAPSHOT - pom - - - annotation-processor-dep-v1 - annotation-processor-dep-v2 - annotation-processor - annotation-user - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - @project.version@ - - - - - diff --git a/src/it/MCOMPILER-512/invoker.properties b/src/it/MCOMPILER-512/invoker.properties deleted file mode 100644 index 9bcebc20..00000000 --- a/src/it/MCOMPILER-512/invoker.properties +++ /dev/null @@ -1,20 +0,0 @@ -# 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 deleted file mode 100644 index 5e15953a..00000000 --- a/src/it/MCOMPILER-512/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - 4.0.0 - - org.apache.maven.plugins - maven-compiler-plugin-MCOMPILER512 - 1.0.0-SNAPSHOT - jar - - - UTF-8 - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - @pom.version@ - - - - diff --git a/src/it/MCOMPILER-512/src/main/java/dummy/Main.java b/src/it/MCOMPILER-512/src/main/java/dummy/Main.java deleted file mode 100644 index 09cdacc5..00000000 --- a/src/it/MCOMPILER-512/src/main/java/dummy/Main.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ -package dummy; - -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 deleted file mode 100644 index eb7058cd..00000000 --- a/src/it/MCOMPILER-512/src/test/java/dummy/Test.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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. - */ -package dummy; - -import javax.smartcardio.TerminalFactory; - -public class Test { - public void test() { - TerminalFactory tf = TerminalFactory.getDefault(); - } -} diff --git a/src/it/MCOMPILER-522-unresolvable-dependency/invoker.properties b/src/it/MCOMPILER-522-unresolvable-dependency/invoker.properties deleted file mode 100644 index 9e2dad8a..00000000 --- a/src/it/MCOMPILER-522-unresolvable-dependency/invoker.properties +++ /dev/null @@ -1,19 +0,0 @@ -# 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 = compile -invoker.buildResult = failure diff --git a/src/it/MCOMPILER-522-unresolvable-dependency/pom.xml b/src/it/MCOMPILER-522-unresolvable-dependency/pom.xml deleted file mode 100644 index 0614cd0d..00000000 --- a/src/it/MCOMPILER-522-unresolvable-dependency/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - 4.0.0 - - org.apache.maven.plugins.compiler.it - mcompiler522-unresolvable-annotation-processor-depdendency - 1.0-SNAPSHOT - - - - - org.apache.maven.plugins - maven-compiler-plugin - @project.version@ - - - org.issue.SimpleAnnotationProcessor - - - - org.apache.maven.plugins.compiler.it - annotation-processor-non-existing - 1.0-SNAPSHOT - - - - - - - diff --git a/src/it/MCOMPILER-522-unresolvable-dependency/src/main/java/org/apache.maven.plugins.compiler.it/SimpleAnnotation.java b/src/it/MCOMPILER-522-unresolvable-dependency/src/main/java/org/apache.maven.plugins.compiler.it/SimpleAnnotation.java deleted file mode 100644 index f84e9d09..00000000 --- a/src/it/MCOMPILER-522-unresolvable-dependency/src/main/java/org/apache.maven.plugins.compiler.it/SimpleAnnotation.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ -package org.apache.maven.plugins.compiler.it; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.SOURCE) -public @interface SimpleAnnotation {} diff --git a/src/it/MCOMPILER-522-unresolvable-dependency/src/main/java/org/apache.maven.plugins.compiler.it/SimpleObject.java b/src/it/MCOMPILER-522-unresolvable-dependency/src/main/java/org/apache.maven.plugins.compiler.it/SimpleObject.java deleted file mode 100644 index 9f507195..00000000 --- a/src/it/MCOMPILER-522-unresolvable-dependency/src/main/java/org/apache.maven.plugins.compiler.it/SimpleObject.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - * 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. - */ -package org.apache.maven.plugins.compiler.it; - -@SimpleAnnotation -public class SimpleObject {} diff --git a/src/it/MCOMPILER-522-unresolvable-dependency/verify.groovy b/src/it/MCOMPILER-522-unresolvable-dependency/verify.groovy deleted file mode 100644 index fcb0d735..00000000 --- a/src/it/MCOMPILER-522-unresolvable-dependency/verify.groovy +++ /dev/null @@ -1,27 +0,0 @@ - -/* - * 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. - */ -def logFile = new File( basedir, 'build.log' ) -assert logFile.exists() - -def buildLog = logFile.getText('UTF-8') -assert buildLog.contains( "Caused by: org.apache.maven.plugin.MojoExecutionException: " + - "Resolution of annotationProcessorPath dependencies failed: " ) -assert buildLog.contains( - "The POM for org.apache.maven.plugins.compiler.it:annotation-processor-non-existing:jar:1.0-SNAPSHOT is missing, no dependency information available" ) diff --git a/src/it/MCOMPILER-525/invoker.properties b/src/it/MCOMPILER-525/invoker.properties deleted file mode 100644 index da0f0927..00000000 --- a/src/it/MCOMPILER-525/invoker.properties +++ /dev/null @@ -1,21 +0,0 @@ -# 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. - -# NOTE: The first time, we run up to "integration-test" phase which includes the AntRun execution which saves the -# timestamp of the first JAR for comparison with the timestamp of the JAR from the final "package" invocation. -# Note: -invoker.goals = clean integration-test package -Dmaven.compiler.showCompilationChanges=true diff --git a/src/it/MCOMPILER-525/pom.xml b/src/it/MCOMPILER-525/pom.xml deleted file mode 100644 index ce4080ea..00000000 --- a/src/it/MCOMPILER-525/pom.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - 4.0.0 - org.apache.maven.plugins - MCOMPILER-525-no-recreation - MCOMPILER-525-no-recreation - jar - 1.0-SNAPSHOT - - - - - org.apache.maven.plugins - maven-compiler-plugin - @project.version@ - - - org.apache.maven.plugins - maven-jar-plugin - @version.maven-jar-plugin@ - - - org.apache.maven.plugins - maven-antrun-plugin - @version.maven-antrun-plugin@ - - - touch - integration-test - - run - - - - - - - - - - - - - diff --git a/src/it/MCOMPILER-525/src/main/java/myproject/HelloWorld.java b/src/it/MCOMPILER-525/src/main/java/myproject/HelloWorld.java deleted file mode 100644 index 8318e9fb..00000000 --- a/src/it/MCOMPILER-525/src/main/java/myproject/HelloWorld.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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. - */ -package myproject; - -/** - * The classic Hello World App. - */ -public class HelloWorld { - - /** - * Main method. - * - * @param args Not used - */ - public static void main(String[] args) { - System.out.println("Hi!"); - } -} diff --git a/src/it/MCOMPILER-525/verify.groovy b/src/it/MCOMPILER-525/verify.groovy deleted file mode 100644 index 0e97225d..00000000 --- a/src/it/MCOMPILER-525/verify.groovy +++ /dev/null @@ -1,44 +0,0 @@ - -/* - * 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 java.nio.file.*; -import java.time.*; -import java.time.temporal.* -import java.util.*; - -File target = new File( basedir, "target" ); -assert target.isDirectory() - -File jarFile = new File( target, "MCOMPILER-525-no-recreation-1.0-SNAPSHOT.jar" ); -assert jarFile.isFile() - -File refFile = new File( target, "reference.jar" ); -assert refFile.isFile() - -Instant referenceTimestamp = Files.getLastModifiedTime( refFile.toPath() ) - .toInstant().truncatedTo( ChronoUnit.MILLIS ); -System.out.println( "Reference timestamp: " + referenceTimestamp ); - -Instant actualTimestamp = Files.getLastModifiedTime( jarFile.toPath() ) - .toInstant().truncatedTo( ChronoUnit.MILLIS ); -System.out.println( "Actual timestamp : " + actualTimestamp ); - -assert referenceTimestamp.equals(actualTimestamp), - "Timestamps don't match, JAR was recreated although contents has not changed" diff --git a/src/it/MCOMPILER-542/invoker.properties b/src/it/MCOMPILER-542/invoker.properties deleted file mode 100644 index 1c24cc31..00000000 --- a/src/it/MCOMPILER-542/invoker.properties +++ /dev/null @@ -1,18 +0,0 @@ -# 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-542/pom.xml b/src/it/MCOMPILER-542/pom.xml deleted file mode 100644 index f830edd4..00000000 --- a/src/it/MCOMPILER-542/pom.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - 4.0.0 - - org.apache.maven.plugins.compiler.it - MCOMPILER-542 - 1.0-SNAPSHOT - ${java.specification.version} - - - UTF-8 - 2023-08-14T15:12:12Z - - - - - org.slf4j - slf4j-jdk-platform-logging - 2.0.9 - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - @project.version@ - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - default-compile - - compile - - - ${java.specification.version} - - - - compile-release-9 - - compile - - - 9 - ${project.build.outputDirectory}-9 - - - - compile-target - - compile - - - ${java.specification.version} - ${java.specification.version} - ${project.build.outputDirectory}-target - - - - - - - diff --git a/src/it/MCOMPILER-542/src/main/java/module-info.java b/src/it/MCOMPILER-542/src/main/java/module-info.java deleted file mode 100644 index ad85f6fe..00000000 --- a/src/it/MCOMPILER-542/src/main/java/module-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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. - */ -module app { - requires java.logging; - requires jdk.zipfs; - requires org.slf4j.jdk.platform.logging; -} diff --git a/src/it/MCOMPILER-542/src/main/java/org/maven/test/Main.java b/src/it/MCOMPILER-542/src/main/java/org/maven/test/Main.java deleted file mode 100644 index 11bc3de4..00000000 --- a/src/it/MCOMPILER-542/src/main/java/org/maven/test/Main.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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. - */ -package org.maven.test; - -public class Main { - - public static void main(String[] args) { - System.out.println("Hello World!"); - } -} diff --git a/src/it/MCOMPILER-542/verify.groovy b/src/it/MCOMPILER-542/verify.groovy deleted file mode 100644 index b51acea4..00000000 --- a/src/it/MCOMPILER-542/verify.groovy +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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. - */ - -// Check if the javap tool is available -def javapTool = java.util.spi.ToolProvider.findFirst("javap") -assert javapTool.isPresent() : "javap tool not found. Make sure you have the JDK installed." - -def moduleDescriptor = new File(basedir, "target/classes/module-info.class") -// Create a list of arguments to pass to the javap tool -String[] args = ["-v", moduleDescriptor] - -def swout = new StringWriter(), swerr = new StringWriter() -// Execute the javap tool with args -def result = javapTool.get().run(new PrintWriter(swout), new PrintWriter(swerr), args) -println swerr.toString().isEmpty() ? "javap output:\n$swout" : "javap error:\n$swerr" -assert (result == 0) : "javap run failed" - -// Assertions of module content -def out = swout.toString() -assert out.contains('// "java.base" ACC_MANDATED') : "module not found in module-info.class" -assert out.contains('// "java.logging"') : "module not found in module-info.class" -assert out.contains('// "jdk.zipfs"') : "module not found in module-info.class" -assert out.contains('// "org.slf4j.jdk.platform.logging"') : "module not found in module-info.class" -assert out.contains('// 2.0.9') : "version of org.slf4j.jdk.platform.logging module not found" - -// Validation that the module-info should not contain the full java version but the spec version. -def javaVersion = System.getProperty('java.version') -def javaSpecVersion = System.getProperty('java.specification.version') -if (javaVersion != javaSpecVersion) { // handle the case when is the first release - assert !out.contains('// ' + javaVersion) : "full java version found in module descriptor" -} -assert out.contains('// ' + javaSpecVersion) : "java specification version not found in module descriptor" - -// Additional validation that the checksum is always the same: useful because constant pool reordering happens when -// transforming bytecode, then we need to check results precisely -def checksumMap = [ - '21': 'SHA-256 checksum ccc6515c8fc1bf4e675e205b2a5200d02545b06014b304c292eeddc68cffee8d', - '17': 'SHA-256 checksum 102f24c71aff97210d66ef791b7d56f8a25ff8692d2c97b21682bc7170aaca9c', - '11': 'MD5 checksum 5779cc6044dcba6ae4060e5a2f8a32c8' -] - -def expectedChecksum = checksumMap[javaSpecVersion] -if (expectedChecksum) { - println "Java version: $javaVersion" - assert out.contains(expectedChecksum) : "checksum doesn't match expected output" -} diff --git a/src/it/MCOMPILER-567-kt/invoker.properties b/src/it/MCOMPILER-567-kt/invoker.properties deleted file mode 100644 index df01a38b..00000000 --- a/src/it/MCOMPILER-567-kt/invoker.properties +++ /dev/null @@ -1,18 +0,0 @@ -# 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 compile diff --git a/src/it/MCOMPILER-567-kt/pom.xml b/src/it/MCOMPILER-567-kt/pom.xml deleted file mode 100644 index a4cf61d0..00000000 --- a/src/it/MCOMPILER-567-kt/pom.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - 4.0.0 - org.apache.maven.plugins - MCOMPILER-567-kt - MCOMPILER-567-kt - jar - 1.0-SNAPSHOT - - - - org.jetbrains.kotlin - kotlin-stdlib - 1.9.21 - - - - - ${project.basedir}/src/main/kotlin - - - org.jetbrains.kotlin - kotlin-maven-plugin - 1.9.21 - - - compile - - compile - - - - - - org.apache.maven.plugins - maven-compiler-plugin - @project.version@ - - - default-compile - none - - - default-testCompile - none - - - java-compile - compile - - compile - - - - - - - diff --git a/src/it/MCOMPILER-567-kt/src/main/kotlin/KotlinService.kt b/src/it/MCOMPILER-567-kt/src/main/kotlin/KotlinService.kt deleted file mode 100644 index 31aee972..00000000 --- a/src/it/MCOMPILER-567-kt/src/main/kotlin/KotlinService.kt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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. - */ - -class KotlinService { - - fun sayHello() { - System.out.println("Kotlin says 'Hello World!'") - } - -} diff --git a/src/it/MCOMPILER-567-kt/verify.groovy b/src/it/MCOMPILER-567-kt/verify.groovy deleted file mode 100644 index 5d1960e0..00000000 --- a/src/it/MCOMPILER-567-kt/verify.groovy +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 target = new File( basedir, "target" ); -assert target.isDirectory() - -assert new File( target, "classes/KotlinService.class" ).exists(); diff --git a/src/it/MCOMPILER-567/invoker.properties b/src/it/MCOMPILER-567/invoker.properties deleted file mode 100644 index e08297d6..00000000 --- a/src/it/MCOMPILER-567/invoker.properties +++ /dev/null @@ -1,18 +0,0 @@ -# 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 = test diff --git a/src/it/MCOMPILER-567/pom.xml b/src/it/MCOMPILER-567/pom.xml deleted file mode 100644 index 1c0af3c5..00000000 --- a/src/it/MCOMPILER-567/pom.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - 4.0.0 - org.apache.maven.plugins - MCOMPILER-567 - MCOMPILER-567 - jar - 1.0-SNAPSHOT - - - - - org.apache.maven.plugins - maven-compiler-plugin - @project.version@ - - - - diff --git a/src/it/MCOMPILER-567/src/test/java/.keep b/src/it/MCOMPILER-567/src/test/java/.keep deleted file mode 100644 index 13a83393..00000000 --- a/src/it/MCOMPILER-567/src/test/java/.keep +++ /dev/null @@ -1,16 +0,0 @@ -# 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. diff --git a/src/it/MCOMPILER-567/verify.groovy b/src/it/MCOMPILER-567/verify.groovy deleted file mode 100644 index d71fe341..00000000 --- a/src/it/MCOMPILER-567/verify.groovy +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 target = new File( basedir, "target" ); -assert target.isDirectory() - -assert new File( target, "classes/Main.class" ).exists(); diff --git a/src/it/automodules-application/pom.xml b/src/it/automodules-application/pom.xml index 76db3018..e87e3aa8 100644 --- a/src/it/automodules-application/pom.xml +++ b/src/it/automodules-application/pom.xml @@ -50,7 +50,7 @@ org.codehaus.plexus plexus-utils - 3.0.24 + 2.0.4 diff --git a/src/it/automodules-application/src/main/java/module-info.java b/src/it/automodules-application/src/main/java/module-info.java index cd75a746..047359df 100644 --- a/src/it/automodules-application/src/main/java/module-info.java +++ b/src/it/automodules-application/src/main/java/module-info.java @@ -1,21 +1,22 @@ -/* - * 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. - */ -module app { - requires plexus.utils; -} +/* + * 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. + */ +module app +{ + requires plexus.utils; +} \ No newline at end of file diff --git a/src/it/automodules-application/src/main/java/org/maven/test/Main.java b/src/it/automodules-application/src/main/java/org/maven/test/Main.java index 76cd55e4..eea50369 100644 --- a/src/it/automodules-application/src/main/java/org/maven/test/Main.java +++ b/src/it/automodules-application/src/main/java/org/maven/test/Main.java @@ -1,31 +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. - */ -package org.maven.test; - -import org.codehaus.plexus.util.StringUtils; - -public class Main { - - /** - * @param args - */ - public static void main(String[] args) { - System.out.println(StringUtils.concatenate(args)); - } -} +package org.maven.test; + +/* + * 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 org.codehaus.plexus.util.StringUtils; + +public class Main { + + /** + * @param args + */ + public static void main(String[] args) { + System.out.println( StringUtils.concatenate( args ) ); + } +} diff --git a/src/it/automodules-application/verify.groovy b/src/it/automodules-application/verify.groovy index 4ef9be37..7f2654b8 100644 --- a/src/it/automodules-application/verify.groovy +++ b/src/it/automodules-application/verify.groovy @@ -19,4 +19,4 @@ buildLog = new File( basedir, 'build.log' ).text; -assert buildLog.contains("[INFO] Required filename-based automodules detected: [plexus-utils-3.0.24.jar]. Please don't publish this project to a public artifact repository!"); +assert buildLog.contains("[INFO] Required filename-based automodules detected: [plexus-utils-2.0.4.jar]. Please don't publish this project to a public artifact repository!"); diff --git a/src/it/automodules-library/pom.xml b/src/it/automodules-library/pom.xml index 76db3018..e87e3aa8 100644 --- a/src/it/automodules-library/pom.xml +++ b/src/it/automodules-library/pom.xml @@ -50,7 +50,7 @@ org.codehaus.plexus plexus-utils - 3.0.24 + 2.0.4 diff --git a/src/it/automodules-library/src/main/java/module-info.java b/src/it/automodules-library/src/main/java/module-info.java index ace11219..17205e31 100644 --- a/src/it/automodules-library/src/main/java/module-info.java +++ b/src/it/automodules-library/src/main/java/module-info.java @@ -1,23 +1,24 @@ -/* - * 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. - */ -module lib { - requires plexus.utils; - - exports org.maven.test; -} +/* + * 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. + */ +module lib +{ + requires plexus.utils; + + exports org.maven.test; +} \ No newline at end of file diff --git a/src/it/automodules-library/src/main/java/org/maven/test/Main.java b/src/it/automodules-library/src/main/java/org/maven/test/Main.java index 76cd55e4..463feac7 100644 --- a/src/it/automodules-library/src/main/java/org/maven/test/Main.java +++ b/src/it/automodules-library/src/main/java/org/maven/test/Main.java @@ -1,31 +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. - */ -package org.maven.test; - -import org.codehaus.plexus.util.StringUtils; - -public class Main { - - /** - * @param args - */ - public static void main(String[] args) { - System.out.println(StringUtils.concatenate(args)); - } -} +package org.maven.test; + +/* + * 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 org.codehaus.plexus.util.StringUtils; + +public class Main { + + /** + * @param args + */ + public static void main(String[] args) { + System.out.println( StringUtils.concatenate( args ) ); + } +} \ No newline at end of file diff --git a/src/it/automodules-library/verify.groovy b/src/it/automodules-library/verify.groovy index 44369625..6a014a5a 100644 --- a/src/it/automodules-library/verify.groovy +++ b/src/it/automodules-library/verify.groovy @@ -19,4 +19,4 @@ buildLog = new File( basedir, 'build.log' ).text; -assert buildLog.contains("[WARNING] * Required filename-based automodules detected: [plexus-utils-3.0.24.jar]. Please don't publish this project to a public artifact repository! *"); +assert buildLog.contains("[WARNING] * Required filename-based automodules detected: [plexus-utils-2.0.4.jar]. Please don't publish this project to a public artifact repository! *"); diff --git a/src/it/automodules-manifest/src/main/java/module-info.java b/src/it/automodules-manifest/src/main/java/module-info.java index 684f7e3b..5bd017f6 100644 --- a/src/it/automodules-manifest/src/main/java/module-info.java +++ b/src/it/automodules-manifest/src/main/java/module-info.java @@ -1,21 +1,22 @@ -/* - * 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. - */ -module app { - requires com.ta3; -} +/* + * 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. + */ +module app +{ + requires com.ta3; +} \ No newline at end of file diff --git a/src/it/automodules-manifest/src/main/java/org/maven/test/Main.java b/src/it/automodules-manifest/src/main/java/org/maven/test/Main.java index 642ee05f..b81a7208 100644 --- a/src/it/automodules-manifest/src/main/java/org/maven/test/Main.java +++ b/src/it/automodules-manifest/src/main/java/org/maven/test/Main.java @@ -1,25 +1,28 @@ -/* - * 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. - */ -package org.maven.test; - -public class Main { - public static void main(String[] args) { - System.out.println(com.ta3.MyClass.class.getName()); - } -} +package org.maven.test; + +/* + * 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 Main +{ + public static void main( String[] args ) + { + System.out.println( com.ta3.MyClass.class.getName() ); + } +} diff --git a/src/it/automodules-transitive-module/pom.xml b/src/it/automodules-transitive-module/pom.xml index 76db3018..e87e3aa8 100644 --- a/src/it/automodules-transitive-module/pom.xml +++ b/src/it/automodules-transitive-module/pom.xml @@ -50,7 +50,7 @@ org.codehaus.plexus plexus-utils - 3.0.24 + 2.0.4 diff --git a/src/it/automodules-transitive-module/src/main/java/module-info.java b/src/it/automodules-transitive-module/src/main/java/module-info.java index ace11219..17205e31 100644 --- a/src/it/automodules-transitive-module/src/main/java/module-info.java +++ b/src/it/automodules-transitive-module/src/main/java/module-info.java @@ -1,23 +1,24 @@ -/* - * 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. - */ -module lib { - requires plexus.utils; - - exports org.maven.test; -} +/* + * 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. + */ +module lib +{ + requires plexus.utils; + + exports org.maven.test; +} \ No newline at end of file diff --git a/src/it/automodules-transitive-module/src/main/java/org/maven/test/Main.java b/src/it/automodules-transitive-module/src/main/java/org/maven/test/Main.java index 76cd55e4..463feac7 100644 --- a/src/it/automodules-transitive-module/src/main/java/org/maven/test/Main.java +++ b/src/it/automodules-transitive-module/src/main/java/org/maven/test/Main.java @@ -1,31 +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. - */ -package org.maven.test; - -import org.codehaus.plexus.util.StringUtils; - -public class Main { - - /** - * @param args - */ - public static void main(String[] args) { - System.out.println(StringUtils.concatenate(args)); - } -} +package org.maven.test; + +/* + * 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 org.codehaus.plexus.util.StringUtils; + +public class Main { + + /** + * @param args + */ + public static void main(String[] args) { + System.out.println( StringUtils.concatenate( args ) ); + } +} \ No newline at end of file diff --git a/src/it/automodules-transitive-module/verify.groovy b/src/it/automodules-transitive-module/verify.groovy index 44369625..6a014a5a 100644 --- a/src/it/automodules-transitive-module/verify.groovy +++ b/src/it/automodules-transitive-module/verify.groovy @@ -19,4 +19,4 @@ buildLog = new File( basedir, 'build.log' ).text; -assert buildLog.contains("[WARNING] * Required filename-based automodules detected: [plexus-utils-3.0.24.jar]. Please don't publish this project to a public artifact repository! *"); +assert buildLog.contains("[WARNING] * Required filename-based automodules detected: [plexus-utils-2.0.4.jar]. Please don't publish this project to a public artifact repository! *"); diff --git a/src/it/default-fork-windows/src/main/java/MyClass.java b/src/it/default-fork-windows/src/main/java/MyClass.java index d4132bb2..4945381a 100644 --- a/src/it/default-fork-windows/src/main/java/MyClass.java +++ b/src/it/default-fork-windows/src/main/java/MyClass.java @@ -6,9 +6,9 @@ * 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 @@ -16,6 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class MyClass {} +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 index 77db4f1d..46ba41d4 100644 --- a/src/it/default-fork-windows/src/test/java/MyTest.java +++ b/src/it/default-fork-windows/src/test/java/MyTest.java @@ -6,9 +6,9 @@ * 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 @@ -16,8 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -package foo; import junit.framework.TestCase; -public class MyTest extends TestCase {} +public class MyTest + extends TestCase +{ + +} diff --git a/src/it/default-fork-windows/verify.groovy b/src/it/default-fork-windows/verify.groovy index 2d4a24c5..6b1651d7 100644 --- a/src/it/default-fork-windows/verify.groovy +++ b/src/it/default-fork-windows/verify.groovy @@ -17,9 +17,9 @@ * under the License. */ -assert new File( basedir, 'target/classes/foo/MyClass.class').exists() +assert new File( basedir, 'target/classes/MyClass.class').exists() -assert new File( basedir, 'target/test-classes/foo/MyTest.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() diff --git a/src/it/default-fork/src/main/java/MyClass.java b/src/it/default-fork/src/main/java/MyClass.java index d4132bb2..4945381a 100644 --- a/src/it/default-fork/src/main/java/MyClass.java +++ b/src/it/default-fork/src/main/java/MyClass.java @@ -6,9 +6,9 @@ * 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 @@ -16,6 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class MyClass {} +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 index 77db4f1d..46ba41d4 100644 --- a/src/it/default-fork/src/test/java/MyTest.java +++ b/src/it/default-fork/src/test/java/MyTest.java @@ -6,9 +6,9 @@ * 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 @@ -16,8 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -package foo; import junit.framework.TestCase; -public class MyTest extends TestCase {} +public class MyTest + extends TestCase +{ + +} diff --git a/src/it/default-fork/verify.groovy b/src/it/default-fork/verify.groovy index 6fb1fa1e..ba3bd7a2 100644 --- a/src/it/default-fork/verify.groovy +++ b/src/it/default-fork/verify.groovy @@ -17,9 +17,9 @@ * under the License. */ -assert new File( basedir, 'target/classes/foo/MyClass.class').exists() +assert new File( basedir, 'target/classes/MyClass.class').exists() -assert new File( basedir, 'target/test-classes/foo/MyTest.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() diff --git a/src/it/MCOMPILER-567/src/main/java/Main.java b/src/it/default-incremental-disable/src/main/java/MyClass.java similarity index 95% rename from src/it/MCOMPILER-567/src/main/java/Main.java rename to src/it/default-incremental-disable/src/main/java/MyClass.java index 48add13b..4945381a 100644 --- a/src/it/MCOMPILER-567/src/main/java/Main.java +++ b/src/it/default-incremental-disable/src/main/java/MyClass.java @@ -6,9 +6,9 @@ * 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 @@ -16,4 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -public class Main {} + +public class MyClass +{ + +} diff --git a/src/it/default-incremental-disable/src/main/java/foo/MyClass.java b/src/it/default-incremental-disable/src/main/java/foo/MyClass.java deleted file mode 100644 index d4132bb2..00000000 --- a/src/it/default-incremental-disable/src/main/java/foo/MyClass.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ -package foo; - -public class MyClass {} diff --git a/src/it/default-incremental-disable/src/test/java/foo/MyTest.java b/src/it/default-incremental-disable/src/test/java/MyTest.java similarity index 93% rename from src/it/default-incremental-disable/src/test/java/foo/MyTest.java rename to src/it/default-incremental-disable/src/test/java/MyTest.java index 77db4f1d..46ba41d4 100644 --- a/src/it/default-incremental-disable/src/test/java/foo/MyTest.java +++ b/src/it/default-incremental-disable/src/test/java/MyTest.java @@ -6,9 +6,9 @@ * 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 @@ -16,8 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -package foo; import junit.framework.TestCase; -public class MyTest extends TestCase {} +public class MyTest + extends TestCase +{ + +} diff --git a/src/it/default-incremental-disable/verify.groovy b/src/it/default-incremental-disable/verify.groovy index 2f9fe2c6..2f72f1c9 100644 --- a/src/it/default-incremental-disable/verify.groovy +++ b/src/it/default-incremental-disable/verify.groovy @@ -17,8 +17,8 @@ * under the License. */ -assert new File( basedir, "target/classes/foo/MyClass.class" ).exists(); -assert new File( basedir, "target/test-classes/foo/MyTest.class" ).exists(); +assert new File( basedir, "target/classes/MyClass.class" ).exists(); +assert new File( basedir, "target/test-classes/MyTest.class" ).exists(); content = new File( basedir, 'build.log' ).text; diff --git a/src/it/default/src/main/java/MyClass.java b/src/it/default/src/main/java/MyClass.java index d4132bb2..4945381a 100644 --- a/src/it/default/src/main/java/MyClass.java +++ b/src/it/default/src/main/java/MyClass.java @@ -6,9 +6,9 @@ * 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 @@ -16,6 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class MyClass {} +public class MyClass +{ + +} diff --git a/src/it/default/src/test/java/MyTest.java b/src/it/default/src/test/java/MyTest.java index 77db4f1d..46ba41d4 100644 --- a/src/it/default/src/test/java/MyTest.java +++ b/src/it/default/src/test/java/MyTest.java @@ -6,9 +6,9 @@ * 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 @@ -16,8 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -package foo; import junit.framework.TestCase; -public class MyTest extends TestCase {} +public class MyTest + extends TestCase +{ + +} diff --git a/src/it/default/verify.bsh b/src/it/default/verify.bsh index 402fb942..12bb5436 100644 --- a/src/it/default/verify.bsh +++ b/src/it/default/verify.bsh @@ -23,14 +23,14 @@ import java.util.regex.*; try { - File mainClass = new File( basedir, "target/classes/foo/MyClass.class" ); + File mainClass = new File( basedir, "target/classes/MyClass.class" ); if ( !mainClass.isFile() ) { System.out.println( "Main class not existent: " + mainClass ); return false; } - File testClass = new File( basedir, "target/test-classes/foo/MyTest.class" ); + File testClass = new File( basedir, "target/test-classes/MyTest.class" ); if ( !testClass.isFile() ) { System.out.println( "Test class not existent: " + testClass ); diff --git a/src/it/groovy-project-with-new-plexus-compiler/verify.groovy b/src/it/groovy-project-with-new-plexus-compiler/verify.groovy index 4ea3c478..500f7f96 100644 --- a/src/it/groovy-project-with-new-plexus-compiler/verify.groovy +++ b/src/it/groovy-project-with-new-plexus-compiler/verify.groovy @@ -1,3 +1,4 @@ + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/src/it/includes-excludes/src/main/java/org/apache/maven/it0055/Person.java b/src/it/includes-excludes/src/main/java/org/apache/maven/it0055/Person.java index 1fa3d8cf..d1ecf61c 100644 --- a/src/it/includes-excludes/src/main/java/org/apache/maven/it0055/Person.java +++ b/src/it/includes-excludes/src/main/java/org/apache/maven/it0055/Person.java @@ -1,3 +1,5 @@ +package org.apache.maven.it0055; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,16 +18,19 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.it0055; -public class Person { - private String name; - public void setName(String name) { +public class Person +{ + private String name; + + public void setName( String name ) + { this.name = name; } - - public String getName() { + + public String getName() + { return name; } } diff --git a/src/it/includes-excludes/src/main/java/org/apache/maven/it0055/PersonTwo.java b/src/it/includes-excludes/src/main/java/org/apache/maven/it0055/PersonTwo.java index 8bb36452..7f1914b6 100644 --- a/src/it/includes-excludes/src/main/java/org/apache/maven/it0055/PersonTwo.java +++ b/src/it/includes-excludes/src/main/java/org/apache/maven/it0055/PersonTwo.java @@ -1,3 +1,5 @@ +package org.apache.maven.it0055; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,16 +18,19 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.it0055; -public class PersonTwo { - private String name; - public void setName(String name) { +public class PersonTwo +{ + private String name; + + public void setName( String name ) + { this.name = name; } - - public String getName() { + + public String getName() + { return name; } } diff --git a/src/it/includes-excludes/src/test/java/org/apache/maven/it0055/PersonTest.java b/src/it/includes-excludes/src/test/java/org/apache/maven/it0055/PersonTest.java index f3601658..c8c40ed0 100644 --- a/src/it/includes-excludes/src/test/java/org/apache/maven/it0055/PersonTest.java +++ b/src/it/includes-excludes/src/test/java/org/apache/maven/it0055/PersonTest.java @@ -1,3 +1,5 @@ +package org.apache.maven.it0055; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,16 +18,19 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.it0055; + import junit.framework.TestCase; -public class PersonTest extends TestCase { - public void testPerson() { +public class PersonTest + extends TestCase +{ + public void testPerson() + { Person person = new Person(); - - person.setName("foo"); - - assertEquals("foo", person.getName()); + + person.setName( "foo" ); + + assertEquals( "foo", person.getName() ); } } diff --git a/src/it/includes-excludes/src/test/java/org/apache/maven/it0055/PersonTwoTest.java b/src/it/includes-excludes/src/test/java/org/apache/maven/it0055/PersonTwoTest.java index a9096ee3..6a51799c 100644 --- a/src/it/includes-excludes/src/test/java/org/apache/maven/it0055/PersonTwoTest.java +++ b/src/it/includes-excludes/src/test/java/org/apache/maven/it0055/PersonTwoTest.java @@ -1,3 +1,5 @@ +package org.apache.maven.it0055; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,16 +18,19 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.it0055; + import junit.framework.TestCase; -public class PersonTwoTest extends TestCase { - public void testPerson() { +public class PersonTwoTest + extends TestCase +{ + public void testPerson() + { Person person = new Person(); - - person.setName("foo"); - - assertEquals("foo", person.getName()); + + person.setName( "foo" ); + + assertEquals( "foo", person.getName() ); } } diff --git a/src/it/jdk16-annotation/src/main/java/com/mycompany/jdk16annotation/App.java b/src/it/jdk16-annotation/src/main/java/com/mycompany/jdk16annotation/App.java index 41ebecd3..814edb98 100644 --- a/src/it/jdk16-annotation/src/main/java/com/mycompany/jdk16annotation/App.java +++ b/src/it/jdk16-annotation/src/main/java/com/mycompany/jdk16annotation/App.java @@ -1,3 +1,5 @@ +package com.mycompany.jdk16annotation; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,14 +18,16 @@ * specific language governing permissions and limitations * under the License. */ -package com.mycompany.jdk16annotation; + /** * Hello world! * */ -public class App { - public static void main(String[] args) { - System.out.println("Hello World!"); +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); } } diff --git a/src/it/jdk16-annotation/src/main/java/com/mycompany/jdk16annotation/ServiceProvider.java b/src/it/jdk16-annotation/src/main/java/com/mycompany/jdk16annotation/ServiceProvider.java index a7921fdb..b87cc680 100644 --- a/src/it/jdk16-annotation/src/main/java/com/mycompany/jdk16annotation/ServiceProvider.java +++ b/src/it/jdk16-annotation/src/main/java/com/mycompany/jdk16annotation/ServiceProvider.java @@ -1,3 +1,5 @@ +package com.mycompany.jdk16annotation; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,19 +18,19 @@ * specific language governing permissions and limitations * under the License. */ -package com.mycompany.jdk16annotation; + import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; + + @Retention(RetentionPolicy.SOURCE) @Target(ElementType.TYPE) public @interface ServiceProvider { Class service(); - int position() default Integer.MAX_VALUE; - String path() default ""; } diff --git a/src/it/jdk16-annotation/src/main/java/com/mycompany/jdk16annotation/ServiceProviderProcessor.java b/src/it/jdk16-annotation/src/main/java/com/mycompany/jdk16annotation/ServiceProviderProcessor.java index f5777e90..8f39d10c 100644 --- a/src/it/jdk16-annotation/src/main/java/com/mycompany/jdk16annotation/ServiceProviderProcessor.java +++ b/src/it/jdk16-annotation/src/main/java/com/mycompany/jdk16annotation/ServiceProviderProcessor.java @@ -1,3 +1,5 @@ +package com.mycompany.jdk16annotation; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,31 +18,33 @@ * specific language governing permissions and limitations * under the License. */ -package com.mycompany.jdk16annotation; + +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.PrintWriter; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; import javax.lang.model.element.Element; import javax.lang.model.element.TypeElement; + import javax.tools.Diagnostic.Kind; import javax.tools.FileObject; import javax.tools.StandardLocation; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; - @SupportedSourceVersion(SourceVersion.RELEASE_6) public class ServiceProviderProcessor extends AbstractProcessor { public @Override Set getSupportedAnnotationTypes() { - return new HashSet(Arrays.asList(ServiceProvider.class.getCanonicalName())); + return new HashSet(Arrays.asList( + ServiceProvider.class.getCanonicalName() + )); } /** public for ServiceLoader */ @@ -57,18 +61,14 @@ public boolean process(Set annotations, RoundEnvironment } else { return true; } + } private void writeServices() { try { - FileObject out = processingEnv - .getFiler() - .createResource(StandardLocation.CLASS_OUTPUT, "", "META-INF/one", new Element[0]); + FileObject out = processingEnv.getFiler().createResource(StandardLocation.CLASS_OUTPUT, "", "META-INF/one",new Element[0]); OutputStream os = out.openOutputStream(); - OutputStream os2 = processingEnv - .getFiler() - .createSourceFile("org.Milos", new Element[0]) - .openOutputStream(); + OutputStream os2 = processingEnv.getFiler().createSourceFile("org.Milos", new Element[0]).openOutputStream(); OutputStreamWriter osr = new OutputStreamWriter(os2); try { PrintWriter w = new PrintWriter(new OutputStreamWriter(os, "UTF-8")); @@ -82,8 +82,10 @@ private void writeServices() { os.close(); } + } catch (IOException x) { processingEnv.getMessager().printMessage(Kind.ERROR, "Failed to write to one: " + x.toString()); } } + } diff --git a/src/it/jdk16-annotation/src/test/java/com/mycompany/jdk16annotation/AppTest.java b/src/it/jdk16-annotation/src/test/java/com/mycompany/jdk16annotation/AppTest.java index 63bde8ed..9faeebec 100644 --- a/src/it/jdk16-annotation/src/test/java/com/mycompany/jdk16annotation/AppTest.java +++ b/src/it/jdk16-annotation/src/test/java/com/mycompany/jdk16annotation/AppTest.java @@ -1,3 +1,5 @@ +package com.mycompany.jdk16annotation; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,7 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package com.mycompany.jdk16annotation; + import junit.framework.Test; import junit.framework.TestCase; @@ -25,28 +27,33 @@ /** * Unit test for simple App. */ -@ServiceProvider(service = App.class, path = "xxx", position = 1) -public class AppTest extends TestCase { +@ServiceProvider(service=App.class, path="xxx", position=1) +public class AppTest + extends TestCase +{ /** * Create the test case * * @param testName name of the test case */ - public AppTest(String testName) { - super(testName); + public AppTest( String testName ) + { + super( testName ); } /** * @return the suite of tests being tested */ - public static Test suite() { - return new TestSuite(AppTest.class); + public static Test suite() + { + return new TestSuite( AppTest.class ); } /** * Rigourous Test :-) */ - public void testApp() { - assertTrue(true); + public void testApp() + { + assertTrue( true ); } } diff --git a/src/it/jdk9-exportsto/bar/src/main/java/module-info.java b/src/it/jdk9-exportsto/bar/src/main/java/module-info.java index 5cdec552..22d23765 100644 --- a/src/it/jdk9-exportsto/bar/src/main/java/module-info.java +++ b/src/it/jdk9-exportsto/bar/src/main/java/module-info.java @@ -1,22 +1,22 @@ -/* - * 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. - */ - -module bar { - requires foo; -} +/* + * 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. + */ + +module bar { + requires foo; +} \ No newline at end of file diff --git a/src/it/jdk9-exportsto/foo/src/main/java/foo/Foo.java b/src/it/jdk9-exportsto/foo/src/main/java/foo/Foo.java index 0fd6b804..156976c8 100644 --- a/src/it/jdk9-exportsto/foo/src/main/java/foo/Foo.java +++ b/src/it/jdk9-exportsto/foo/src/main/java/foo/Foo.java @@ -1,21 +1,22 @@ -/* - * 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. - */ -package foo; - -public class Foo {} +package foo; + +/* + * 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 Foo {} \ No newline at end of file diff --git a/src/it/jdk9-exportsto/foo/src/main/java/module-info.java b/src/it/jdk9-exportsto/foo/src/main/java/module-info.java index 48dd5786..17d226f2 100644 --- a/src/it/jdk9-exportsto/foo/src/main/java/module-info.java +++ b/src/it/jdk9-exportsto/foo/src/main/java/module-info.java @@ -1,23 +1,22 @@ -/* - * 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. - */ - -module foo { - exports foo to - bar; -} +/* + * 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. + */ + +module foo { + exports foo to bar; +} \ No newline at end of file diff --git a/src/it/jpms_add-exports/src/main/java/module-info.java b/src/it/jpms_add-exports/src/main/java/module-info.java index cfa968a8..c48284ef 100644 --- a/src/it/jpms_add-exports/src/main/java/module-info.java +++ b/src/it/jpms_add-exports/src/main/java/module-info.java @@ -1,19 +1,22 @@ -/* - * 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. - */ -module app {} +/* + * 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. + */ +module app +{ + +} \ No newline at end of file diff --git a/src/it/jpms_add-exports/src/main/java/org/maven/test/Main.java b/src/it/jpms_add-exports/src/main/java/org/maven/test/Main.java index 8fab0b26..51d5c4a6 100644 --- a/src/it/jpms_add-exports/src/main/java/org/maven/test/Main.java +++ b/src/it/jpms_add-exports/src/main/java/org/maven/test/Main.java @@ -1,33 +1,36 @@ -/* - * 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. - */ -package org.maven.test; - -public class Main { - - /** - * @param args - */ - public static void main(String[] args) { - try { - Class.forName("jdk.internal.util.Preconditions").newInstance(); - } catch (Exception e) { - // noop - } - } -} +package org.maven.test; + +/* + * 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 Main { + + /** + * @param args + */ + public static void main(String[] args) { + try { + Class.forName( "jdk.internal.util.Preconditions" ).newInstance(); + } + catch ( Exception e ) + { + // noop + } + } +} diff --git a/src/it/jpms_compile-main-empty-test-bar/src/test/java/bar/BarTests.java b/src/it/jpms_compile-main-empty-test-bar/src/test/java/bar/BarTests.java index 2316ac32..872ca40f 100644 --- a/src/it/jpms_compile-main-empty-test-bar/src/test/java/bar/BarTests.java +++ b/src/it/jpms_compile-main-empty-test-bar/src/test/java/bar/BarTests.java @@ -19,14 +19,15 @@ package bar; import javax.script.*; - import org.junit.jupiter.api.*; -class BarTests { +class BarTests +{ @Test - void scripting() throws ScriptException { + void scripting() throws ScriptException + { ScriptEngineManager factory = new ScriptEngineManager(); - ScriptEngine engine = factory.getEngineByName("JavaScript"); - Assertions.assertDoesNotThrow(() -> engine.eval("print('Hello, World')"), "Script evaluation failed!"); + ScriptEngine engine = factory.getEngineByName( "JavaScript" ); + Assertions.assertDoesNotThrow​( () -> engine.eval( "print('Hello, World')" ), "Script evaluation failed!" ); } } diff --git a/src/it/jpms_compile-main-empty-test-bar/src/test/java/module-info.java b/src/it/jpms_compile-main-empty-test-bar/src/test/java/module-info.java index 55840434..ed157adf 100644 --- a/src/it/jpms_compile-main-empty-test-bar/src/test/java/module-info.java +++ b/src/it/jpms_compile-main-empty-test-bar/src/test/java/module-info.java @@ -17,7 +17,8 @@ * under the License. */ -open module bar { +open module bar +{ requires java.scripting; requires org.junit.jupiter.api; } diff --git a/src/it/jpms_compile-main-foo-test-bar/src/main/java/foo/Foo.java b/src/it/jpms_compile-main-foo-test-bar/src/main/java/foo/Foo.java index f361b016..efcf8221 100644 --- a/src/it/jpms_compile-main-foo-test-bar/src/main/java/foo/Foo.java +++ b/src/it/jpms_compile-main-foo-test-bar/src/main/java/foo/Foo.java @@ -16,12 +16,15 @@ * specific language governing permissions and limitations * under the License. */ + package foo; import org.apache.commons.lang3.*; -public class Foo { - public Foo() { - System.out.println(StringUtils.swapCase("fOO") + " created!"); +public class Foo +{ + public Foo() + { + System.out.println( StringUtils.swapCase( "fOO" ) + " created!" ); } } diff --git a/src/it/jpms_compile-main-foo-test-bar/src/main/java/module-info.java b/src/it/jpms_compile-main-foo-test-bar/src/main/java/module-info.java index fd24faa4..ec0bd80f 100644 --- a/src/it/jpms_compile-main-foo-test-bar/src/main/java/module-info.java +++ b/src/it/jpms_compile-main-foo-test-bar/src/main/java/module-info.java @@ -17,8 +17,8 @@ * under the License. */ -module foo { +module foo +{ requires org.apache.commons.lang3; - exports foo; } diff --git a/src/it/jpms_compile-main-foo-test-bar/src/test/java/bar/BarTests.java b/src/it/jpms_compile-main-foo-test-bar/src/test/java/bar/BarTests.java index 60ba2856..25d48191 100644 --- a/src/it/jpms_compile-main-foo-test-bar/src/test/java/bar/BarTests.java +++ b/src/it/jpms_compile-main-foo-test-bar/src/test/java/bar/BarTests.java @@ -21,15 +21,18 @@ import foo.*; import org.junit.jupiter.api.*; -class BarTests { +class BarTests +{ @Test - void constructor() { - Assertions.assertNotNull(new Foo()); + void constructor() + { + Assertions.assertNotNull( new Foo() ); } @Test - void moduleNameIsFoo() { - Assertions.assertTrue(Foo.class.getModule().isNamed(), "Foo resides in a named module"); - Assertions.assertEquals("foo", Foo.class.getModule().getName()); + void moduleNameIsFoo() + { + Assertions.assertTrue( Foo.class.getModule().isNamed(), "Foo resides in a named module" ); + Assertions.assertEquals( "foo", Foo.class.getModule().getName() ); } } diff --git a/src/it/jpms_compile-main-foo-test-bar/src/test/java/module-info.java b/src/it/jpms_compile-main-foo-test-bar/src/test/java/module-info.java index 9bd6f9c1..ed971d40 100644 --- a/src/it/jpms_compile-main-foo-test-bar/src/test/java/module-info.java +++ b/src/it/jpms_compile-main-foo-test-bar/src/test/java/module-info.java @@ -17,7 +17,8 @@ * under the License. */ -open module bar { +open module bar +{ requires foo; requires java.scripting; requires org.junit.jupiter.api; diff --git a/src/it/jpms_compile-main-foo-test-foo/src/main/java/foo/Foo.java b/src/it/jpms_compile-main-foo-test-foo/src/main/java/foo/Foo.java index 5e99dc28..8d00c098 100644 --- a/src/it/jpms_compile-main-foo-test-foo/src/main/java/foo/Foo.java +++ b/src/it/jpms_compile-main-foo-test-foo/src/main/java/foo/Foo.java @@ -16,12 +16,15 @@ * specific language governing permissions and limitations * under the License. */ + package foo; import org.apache.commons.lang3.*; -class Foo { - Foo() { - System.out.println(StringUtils.swapCase("fOO") + " created!"); +class Foo +{ + Foo() + { + System.out.println( StringUtils.swapCase( "fOO" ) + " created!" ); } } diff --git a/src/it/jpms_compile-main-foo-test-foo/src/main/java/module-info.java b/src/it/jpms_compile-main-foo-test-foo/src/main/java/module-info.java index 84db0b19..dbd4fea8 100644 --- a/src/it/jpms_compile-main-foo-test-foo/src/main/java/module-info.java +++ b/src/it/jpms_compile-main-foo-test-foo/src/main/java/module-info.java @@ -17,6 +17,7 @@ * under the License. */ -module foo { +module foo +{ requires org.apache.commons.lang3; } diff --git a/src/it/jpms_compile-main-foo-test-foo/src/test/java/foo/FooTests.java b/src/it/jpms_compile-main-foo-test-foo/src/test/java/foo/FooTests.java index 98fb088f..78d1ae1c 100644 --- a/src/it/jpms_compile-main-foo-test-foo/src/test/java/foo/FooTests.java +++ b/src/it/jpms_compile-main-foo-test-foo/src/test/java/foo/FooTests.java @@ -20,15 +20,18 @@ import org.junit.jupiter.api.*; -class FooTests { +class FooTests +{ @Test - void constructor() { - Assertions.assertNotNull(new Foo()); + void constructor() + { + Assertions.assertNotNull( new Foo() ); } @Test - void moduleNameIsFoo() { - Assertions.assertTrue(Foo.class.getModule().isNamed(), "Foo resides in a named module"); - Assertions.assertEquals("foo", Foo.class.getModule().getName()); + void moduleNameIsFoo() + { + Assertions.assertTrue( Foo.class.getModule().isNamed(), "Foo resides in a named module" ); + Assertions.assertEquals( "foo", Foo.class.getModule().getName() ); } } diff --git a/src/it/jpms_compile-main-foo-test-foo/src/test/java/module-info.java b/src/it/jpms_compile-main-foo-test-foo/src/test/java/module-info.java index 38ecd13f..1196f176 100644 --- a/src/it/jpms_compile-main-foo-test-foo/src/test/java/module-info.java +++ b/src/it/jpms_compile-main-foo-test-foo/src/test/java/module-info.java @@ -17,7 +17,8 @@ * under the License. */ -open module foo { +open module foo +{ // main requires org.apache.commons.lang3; diff --git a/src/it/jpms_patch-module/src/main/java/module-info.java b/src/it/jpms_patch-module/src/main/java/module-info.java index cfa968a8..c48284ef 100644 --- a/src/it/jpms_patch-module/src/main/java/module-info.java +++ b/src/it/jpms_patch-module/src/main/java/module-info.java @@ -1,19 +1,22 @@ -/* - * 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. - */ -module app {} +/* + * 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. + */ +module app +{ + +} \ No newline at end of file diff --git a/src/it/jpms_patch-module/src/main/java/org/maven/test/Main.java b/src/it/jpms_patch-module/src/main/java/org/maven/test/Main.java index 8fab0b26..51d5c4a6 100644 --- a/src/it/jpms_patch-module/src/main/java/org/maven/test/Main.java +++ b/src/it/jpms_patch-module/src/main/java/org/maven/test/Main.java @@ -1,33 +1,36 @@ -/* - * 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. - */ -package org.maven.test; - -public class Main { - - /** - * @param args - */ - public static void main(String[] args) { - try { - Class.forName("jdk.internal.util.Preconditions").newInstance(); - } catch (Exception e) { - // noop - } - } -} +package org.maven.test; + +/* + * 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 Main { + + /** + * @param args + */ + public static void main(String[] args) { + try { + Class.forName( "jdk.internal.util.Preconditions" ).newInstance(); + } + catch ( Exception e ) + { + // noop + } + } +} diff --git a/src/it/jpms_patch-module/src/test/java/org/maven/test/MainTest.java b/src/it/jpms_patch-module/src/test/java/org/maven/test/MainTest.java index dbcfba6f..a6fd3af5 100644 --- a/src/it/jpms_patch-module/src/test/java/org/maven/test/MainTest.java +++ b/src/it/jpms_patch-module/src/test/java/org/maven/test/MainTest.java @@ -1,29 +1,30 @@ -/* - * 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. - */ -package org.maven.test; - -public class MainTest { - - /** - * @param args - */ - public static void main(String[] args) { - Main.main(args); - } -} +package org.maven.test; + +/* + * 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 MainTest { + + /** + * @param args + */ + public static void main(String[] args) { + Main.main( args ); + } +} diff --git a/src/it/mcompiler-106/pom.xml b/src/it/mcompiler-106/pom.xml index edbafc0b..466fca11 100644 --- a/src/it/mcompiler-106/pom.xml +++ b/src/it/mcompiler-106/pom.xml @@ -33,10 +33,10 @@ under the License. @project.version@ true - - - true - + + -Xlint + -Xlint:-path + diff --git a/src/it/mcompiler-106/src/main/java/MyClass.java b/src/it/mcompiler-106/src/main/java/MyClass.java index d4132bb2..4945381a 100644 --- a/src/it/mcompiler-106/src/main/java/MyClass.java +++ b/src/it/mcompiler-106/src/main/java/MyClass.java @@ -6,9 +6,9 @@ * 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 @@ -16,6 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class MyClass {} +public class MyClass +{ + +} diff --git a/src/it/mcompiler-106/verify.groovy b/src/it/mcompiler-106/verify.groovy deleted file mode 100644 index 10e4db49..00000000 --- a/src/it/mcompiler-106/verify.groovy +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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. - */ -def logFile = new File( basedir, 'build.log' ) -assert logFile.exists() -content = logFile.text - -assert content.contains( ' -Averbose=true' ) -assert content.contains( ' -Xlint' ) - diff --git a/src/it/mcompiler-120/invoker.properties b/src/it/mcompiler-120/invoker.properties index 98a8e954..86f9130c 100644 --- a/src/it/mcompiler-120/invoker.properties +++ b/src/it/mcompiler-120/invoker.properties @@ -17,3 +17,4 @@ invoker.goals = clean compile invoker.buildResult = failure +invoker.java.version = 1.6+ diff --git a/src/it/mcompiler-120/pom.xml b/src/it/mcompiler-120/pom.xml index c2c03f7d..215363a4 100644 --- a/src/it/mcompiler-120/pom.xml +++ b/src/it/mcompiler-120/pom.xml @@ -30,10 +30,15 @@ under the License. junit junit - 4.13.2 + 4.4 test + + log4j + log4j + 1.2.14 + diff --git a/src/it/mcompiler-120/src/main/java/org/maven/test/Main.java b/src/it/mcompiler-120/src/main/java/org/maven/test/Main.java index 4298c7eb..695e93d1 100644 --- a/src/it/mcompiler-120/src/main/java/org/maven/test/Main.java +++ b/src/it/mcompiler-120/src/main/java/org/maven/test/Main.java @@ -1,3 +1,5 @@ +package org.maven.test; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,11 +18,12 @@ * specific language governing permissions and limitations * under the License. */ -package org.maven.test; import java.util.ArrayList; import java.util.List; + + public class Main { /** * @param args diff --git a/src/it/mcompiler-120/verify.groovy b/src/it/mcompiler-120/verify.groovy index cd6ef26e..c04959f6 100644 --- a/src/it/mcompiler-120/verify.groovy +++ b/src/it/mcompiler-120/verify.groovy @@ -1,3 +1,4 @@ + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/src/it/mcompiler-135/src/main/java/MyClass.java b/src/it/mcompiler-135/src/main/java/MyClass.java index d4132bb2..4945381a 100644 --- a/src/it/mcompiler-135/src/main/java/MyClass.java +++ b/src/it/mcompiler-135/src/main/java/MyClass.java @@ -6,9 +6,9 @@ * 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 @@ -16,6 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class MyClass {} +public class MyClass +{ + +} diff --git a/src/it/mcompiler-179/src/main/java/org/maven/test/MyClass.java b/src/it/mcompiler-179/src/main/java/org/maven/test/MyClass.java index 386f9fed..bfa8aafc 100644 --- a/src/it/mcompiler-179/src/main/java/org/maven/test/MyClass.java +++ b/src/it/mcompiler-179/src/main/java/org/maven/test/MyClass.java @@ -1,3 +1,5 @@ +package org.maven.test; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -6,9 +8,9 @@ * 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 @@ -16,7 +18,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.maven.test; + import java.util.ArrayList; import java.util.List; diff --git a/src/it/mcompiler-182/src/main/java/BeanA.java b/src/it/mcompiler-182/src/main/java/BeanA.java index c53e6bd6..4d314950 100644 --- a/src/it/mcompiler-182/src/main/java/BeanA.java +++ b/src/it/mcompiler-182/src/main/java/BeanA.java @@ -6,9 +6,9 @@ * 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 @@ -16,14 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -package foo; /** * dumb test bean */ public class BeanA { - private int i, y; + private int i,y; public int getI() { return i; diff --git a/src/it/mcompiler-182/src/main/java/BeanA2.java b/src/it/mcompiler-182/src/main/java/BeanA2.java index 076a1fc2..e5725626 100644 --- a/src/it/mcompiler-182/src/main/java/BeanA2.java +++ b/src/it/mcompiler-182/src/main/java/BeanA2.java @@ -6,9 +6,9 @@ * 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 @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ -package foo; /** * dumb test bean diff --git a/src/it/mcompiler-182/verify.groovy b/src/it/mcompiler-182/verify.groovy index 40cb317c..316aeafb 100644 --- a/src/it/mcompiler-182/verify.groovy +++ b/src/it/mcompiler-182/verify.groovy @@ -1,3 +1,4 @@ + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -22,4 +23,4 @@ content = logFile.text assert content.contains( 'COMPILATION ERROR :' ) -assert !new File( basedir, 'target/classes/foo/BeanA.class' ).exists(); +assert !new File( basedir, 'target/classes/BeanA.class' ).exists(); diff --git a/src/it/mcompiler-21_class-remove/src/main/java/BeanA.java b/src/it/mcompiler-21_class-remove/src/main/java/BeanA.java index c53e6bd6..4d314950 100644 --- a/src/it/mcompiler-21_class-remove/src/main/java/BeanA.java +++ b/src/it/mcompiler-21_class-remove/src/main/java/BeanA.java @@ -6,9 +6,9 @@ * 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 @@ -16,14 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -package foo; /** * dumb test bean */ public class BeanA { - private int i, y; + private int i,y; public int getI() { return i; diff --git a/src/it/mcompiler-21_class-remove/src/main/java/BeanA2.java b/src/it/mcompiler-21_class-remove/src/main/java/BeanA2.java index 076a1fc2..e5725626 100644 --- a/src/it/mcompiler-21_class-remove/src/main/java/BeanA2.java +++ b/src/it/mcompiler-21_class-remove/src/main/java/BeanA2.java @@ -6,9 +6,9 @@ * 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 @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ -package foo; /** * dumb test bean diff --git a/src/it/mcompiler-21_class-remove/verify.groovy b/src/it/mcompiler-21_class-remove/verify.groovy index 3e4f8d17..306622da 100644 --- a/src/it/mcompiler-21_class-remove/verify.groovy +++ b/src/it/mcompiler-21_class-remove/verify.groovy @@ -1,3 +1,4 @@ + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/src/it/mcompiler-21_methodname-change/src/main/java/BeanA.java b/src/it/mcompiler-21_methodname-change/src/main/java/BeanA.java index c53e6bd6..4d314950 100644 --- a/src/it/mcompiler-21_methodname-change/src/main/java/BeanA.java +++ b/src/it/mcompiler-21_methodname-change/src/main/java/BeanA.java @@ -6,9 +6,9 @@ * 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 @@ -16,14 +16,13 @@ * specific language governing permissions and limitations * under the License. */ -package foo; /** * dumb test bean */ public class BeanA { - private int i, y; + private int i,y; public int getI() { return i; diff --git a/src/it/mcompiler-21_methodname-change/src/main/java/BeanA2.java b/src/it/mcompiler-21_methodname-change/src/main/java/BeanA2.java index 076a1fc2..e5725626 100644 --- a/src/it/mcompiler-21_methodname-change/src/main/java/BeanA2.java +++ b/src/it/mcompiler-21_methodname-change/src/main/java/BeanA2.java @@ -6,9 +6,9 @@ * 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 @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ -package foo; /** * dumb test bean diff --git a/src/it/mcompiler-21_methodname-change/verify.groovy b/src/it/mcompiler-21_methodname-change/verify.groovy index 3e4f8d17..306622da 100644 --- a/src/it/mcompiler-21_methodname-change/verify.groovy +++ b/src/it/mcompiler-21_methodname-change/verify.groovy @@ -1,3 +1,4 @@ + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file diff --git a/src/it/multirelease-patterns/multimodule/multirelease-base/src/main/java/base/Base.java b/src/it/multirelease-patterns/multimodule/multirelease-base/src/main/java/base/Base.java index 19ec7d8f..513f9099 100644 --- a/src/it/multirelease-patterns/multimodule/multirelease-base/src/main/java/base/Base.java +++ b/src/it/multirelease-patterns/multimodule/multirelease-base/src/main/java/base/Base.java @@ -1,3 +1,5 @@ +package base; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package base; public class Base { diff --git a/src/it/multirelease-patterns/multimodule/multirelease-base/src/main/java/mr/A.java b/src/it/multirelease-patterns/multimodule/multirelease-base/src/main/java/mr/A.java index 0e48eee6..6c2eb86b 100644 --- a/src/it/multirelease-patterns/multimodule/multirelease-base/src/main/java/mr/A.java +++ b/src/it/multirelease-patterns/multimodule/multirelease-base/src/main/java/mr/A.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,15 +18,15 @@ * specific language governing permissions and limitations * under the License. */ -package mr; import base.Base; -public class A implements I { +public class A implements I +{ public static String getString() { return Base.get() + " -> 8"; } - + @Override public Class introducedClass() { return java.time.LocalDateTime.class; diff --git a/src/it/multirelease-patterns/multimodule/multirelease-base/src/main/java/mr/I.java b/src/it/multirelease-patterns/multimodule/multirelease-base/src/main/java/mr/I.java index a0523266..f9858cfc 100644 --- a/src/it/multirelease-patterns/multimodule/multirelease-base/src/main/java/mr/I.java +++ b/src/it/multirelease-patterns/multimodule/multirelease-base/src/main/java/mr/I.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,8 +18,8 @@ * specific language governing permissions and limitations * under the License. */ -package mr; -public interface I { +public interface I +{ Class introducedClass(); -} +} \ No newline at end of file diff --git a/src/it/multirelease-patterns/multimodule/multirelease-base/src/test/java/mr/ATest.java b/src/it/multirelease-patterns/multimodule/multirelease-base/src/test/java/mr/ATest.java index c5ba719e..cca71135 100644 --- a/src/it/multirelease-patterns/multimodule/multirelease-base/src/test/java/mr/ATest.java +++ b/src/it/multirelease-patterns/multimodule/multirelease-base/src/test/java/mr/ATest.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,35 +18,37 @@ * specific language governing permissions and limitations * under the License. */ -package mr; - -import org.junit.Ignore; -import org.junit.Test; -import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.junit.Assume.assumeThat; +import static org.hamcrest.CoreMatchers.is; -public class ATest { - - private static final String javaVersion = System.getProperty("java.version"); +import org.junit.Ignore; +import org.junit.Test; +public class ATest { + + private static final String javaVersion = System.getProperty( "java.version" ); + @Test - public void testGet8() throws Exception { - // assumeThat( javaVersion, is( "8" ) ); - - assertThat(A.getString(), is("BASE -> 8")); + public void testGet8() throws Exception + { +// assumeThat( javaVersion, is( "8" ) ); + + assertThat( A.getString(), is( "BASE -> 8" ) ); - assertThat(new A().introducedClass().getName(), is("java.time.LocalDateTime")); + assertThat( new A().introducedClass().getName(), is( "java.time.LocalDateTime" ) ); } - + @Test - @Ignore("Maven module only creates Java 8 classes") - public void testGet9() throws Exception { - assumeThat(javaVersion, is("9")); + @Ignore( "Maven module only creates Java 8 classes" ) + public void testGet9() throws Exception + { + assumeThat( javaVersion, is( "9" ) ); - assertThat(A.getString(), is("BASE -> 9")); + assertThat( A.getString(), is( "BASE -> 9" ) ); - assertThat(new A().introducedClass().getName(), is("java.lang.Module")); + assertThat( new A().introducedClass().getName(), is( "java.lang.Module" ) ); } -} + +} \ No newline at end of file diff --git a/src/it/multirelease-patterns/multimodule/multirelease-nine/src/main/java/mr/A.java b/src/it/multirelease-patterns/multimodule/multirelease-nine/src/main/java/mr/A.java index 5083e1ce..e2b9598e 100644 --- a/src/it/multirelease-patterns/multimodule/multirelease-nine/src/main/java/mr/A.java +++ b/src/it/multirelease-patterns/multimodule/multirelease-nine/src/main/java/mr/A.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,17 +18,17 @@ * specific language governing permissions and limitations * under the License. */ -package mr; - -import java.util.Optional; import base.Base; -public class A implements I { +import java.util.Optional; + +public class A implements I +{ public static String getString() { - return Base.get() + " -> " + Optional.of("9").get(); + return Base.get() + " -> " + Optional.of( "9" ).get(); } - + @Override public Class introducedClass() { return Module.class; diff --git a/src/it/multirelease-patterns/multimodule/multirelease-nine/src/test/java/mr/ATest.java b/src/it/multirelease-patterns/multimodule/multirelease-nine/src/test/java/mr/ATest.java index c86fc468..ef26fe6d 100644 --- a/src/it/multirelease-patterns/multimodule/multirelease-nine/src/test/java/mr/ATest.java +++ b/src/it/multirelease-patterns/multimodule/multirelease-nine/src/test/java/mr/ATest.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,35 +18,37 @@ * specific language governing permissions and limitations * under the License. */ -package mr; -import org.junit.Ignore; -import org.junit.Test; - -import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.junit.Assume.assumeThat; +import static org.hamcrest.CoreMatchers.is; -public class ATest { - - private static final String javaVersion = System.getProperty("java.version"); +import org.junit.Ignore; +import org.junit.Test; +public class ATest { + + private static final String javaVersion = System.getProperty( "java.version" ); + @Test - @Ignore("Maven module only creates Java 9 classes") - public void testGet8() throws Exception { - assumeThat(javaVersion, is("8")); - - assertThat(A.getString(), is("BASE -> 8")); - - assertThat(new A().introducedClass().getName(), is("java.time.LocalDateTime")); + @Ignore( "Maven module only creates Java 9 classes" ) + public void testGet8() throws Exception + { + assumeThat( javaVersion, is( "8" ) ); + + assertThat( A.getString(), is( "BASE -> 8" ) ); + + assertThat( new A().introducedClass().getName(), is( "java.time.LocalDateTime" ) ); } - + @Test - public void testGet9() throws Exception { - // assumeThat( javaVersion, is( "9" ) ); + public void testGet9() throws Exception + { +// assumeThat( javaVersion, is( "9" ) ); - assertThat(A.getString(), is("BASE -> 9")); + assertThat( A.getString(), is( "BASE -> 9" ) ); - assertThat(new A().introducedClass().getName(), is("java.lang.Module")); + assertThat( new A().introducedClass().getName(), is( "java.lang.Module" ) ); } -} + +} \ No newline at end of file diff --git a/src/it/multirelease-patterns/multimodule/multirelease/pom.xml b/src/it/multirelease-patterns/multimodule/multirelease/pom.xml index d7af7c80..220864cd 100644 --- a/src/it/multirelease-patterns/multimodule/multirelease/pom.xml +++ b/src/it/multirelease-patterns/multimodule/multirelease/pom.xml @@ -35,7 +35,7 @@ maven-assembly-plugin - @version.maven-assembly-plugin@ + 3.1.0 false diff --git a/src/it/multirelease-patterns/multimodule/pom.xml b/src/it/multirelease-patterns/multimodule/pom.xml index b4e48129..bf411e67 100644 --- a/src/it/multirelease-patterns/multimodule/pom.xml +++ b/src/it/multirelease-patterns/multimodule/pom.xml @@ -39,7 +39,7 @@ org.apache.maven.plugins maven-surefire-plugin - @version.maven-surefire@ + 2.21.0 diff --git a/src/it/multirelease-patterns/multiproject/multirelease-base/pom.xml b/src/it/multirelease-patterns/multiproject/multirelease-base/pom.xml index 6c5ad95b..fbf2bcb0 100644 --- a/src/it/multirelease-patterns/multiproject/multirelease-base/pom.xml +++ b/src/it/multirelease-patterns/multiproject/multirelease-base/pom.xml @@ -92,6 +92,7 @@ org.apache.maven.plugins maven-dependency-plugin + 3.1.0 add-java9-supplement diff --git a/src/it/multirelease-patterns/multiproject/multirelease-base/src/main/java/base/Base.java b/src/it/multirelease-patterns/multiproject/multirelease-base/src/main/java/base/Base.java index 19ec7d8f..513f9099 100644 --- a/src/it/multirelease-patterns/multiproject/multirelease-base/src/main/java/base/Base.java +++ b/src/it/multirelease-patterns/multiproject/multirelease-base/src/main/java/base/Base.java @@ -1,3 +1,5 @@ +package base; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package base; public class Base { diff --git a/src/it/multirelease-patterns/multiproject/multirelease-base/src/main/java/mr/A.java b/src/it/multirelease-patterns/multiproject/multirelease-base/src/main/java/mr/A.java index 0e48eee6..6c2eb86b 100644 --- a/src/it/multirelease-patterns/multiproject/multirelease-base/src/main/java/mr/A.java +++ b/src/it/multirelease-patterns/multiproject/multirelease-base/src/main/java/mr/A.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,15 +18,15 @@ * specific language governing permissions and limitations * under the License. */ -package mr; import base.Base; -public class A implements I { +public class A implements I +{ public static String getString() { return Base.get() + " -> 8"; } - + @Override public Class introducedClass() { return java.time.LocalDateTime.class; diff --git a/src/it/multirelease-patterns/multiproject/multirelease-base/src/main/java/mr/I.java b/src/it/multirelease-patterns/multiproject/multirelease-base/src/main/java/mr/I.java index a0523266..f9858cfc 100644 --- a/src/it/multirelease-patterns/multiproject/multirelease-base/src/main/java/mr/I.java +++ b/src/it/multirelease-patterns/multiproject/multirelease-base/src/main/java/mr/I.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,8 +18,8 @@ * specific language governing permissions and limitations * under the License. */ -package mr; -public interface I { +public interface I +{ Class introducedClass(); -} +} \ No newline at end of file diff --git a/src/it/multirelease-patterns/multiproject/multirelease-base/src/test/java/mr/ATest.java b/src/it/multirelease-patterns/multiproject/multirelease-base/src/test/java/mr/ATest.java index c5ba719e..cca71135 100644 --- a/src/it/multirelease-patterns/multiproject/multirelease-base/src/test/java/mr/ATest.java +++ b/src/it/multirelease-patterns/multiproject/multirelease-base/src/test/java/mr/ATest.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,35 +18,37 @@ * specific language governing permissions and limitations * under the License. */ -package mr; - -import org.junit.Ignore; -import org.junit.Test; -import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.junit.Assume.assumeThat; +import static org.hamcrest.CoreMatchers.is; -public class ATest { - - private static final String javaVersion = System.getProperty("java.version"); +import org.junit.Ignore; +import org.junit.Test; +public class ATest { + + private static final String javaVersion = System.getProperty( "java.version" ); + @Test - public void testGet8() throws Exception { - // assumeThat( javaVersion, is( "8" ) ); - - assertThat(A.getString(), is("BASE -> 8")); + public void testGet8() throws Exception + { +// assumeThat( javaVersion, is( "8" ) ); + + assertThat( A.getString(), is( "BASE -> 8" ) ); - assertThat(new A().introducedClass().getName(), is("java.time.LocalDateTime")); + assertThat( new A().introducedClass().getName(), is( "java.time.LocalDateTime" ) ); } - + @Test - @Ignore("Maven module only creates Java 8 classes") - public void testGet9() throws Exception { - assumeThat(javaVersion, is("9")); + @Ignore( "Maven module only creates Java 8 classes" ) + public void testGet9() throws Exception + { + assumeThat( javaVersion, is( "9" ) ); - assertThat(A.getString(), is("BASE -> 9")); + assertThat( A.getString(), is( "BASE -> 9" ) ); - assertThat(new A().introducedClass().getName(), is("java.lang.Module")); + assertThat( new A().introducedClass().getName(), is( "java.lang.Module" ) ); } -} + +} \ No newline at end of file diff --git a/src/it/multirelease-patterns/multiproject/multirelease-nine/src/main/java/mr/A.java b/src/it/multirelease-patterns/multiproject/multirelease-nine/src/main/java/mr/A.java index 5083e1ce..e2b9598e 100644 --- a/src/it/multirelease-patterns/multiproject/multirelease-nine/src/main/java/mr/A.java +++ b/src/it/multirelease-patterns/multiproject/multirelease-nine/src/main/java/mr/A.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,17 +18,17 @@ * specific language governing permissions and limitations * under the License. */ -package mr; - -import java.util.Optional; import base.Base; -public class A implements I { +import java.util.Optional; + +public class A implements I +{ public static String getString() { - return Base.get() + " -> " + Optional.of("9").get(); + return Base.get() + " -> " + Optional.of( "9" ).get(); } - + @Override public Class introducedClass() { return Module.class; diff --git a/src/it/multirelease-patterns/multiproject/multirelease-nine/src/test/java/mr/ATest.java b/src/it/multirelease-patterns/multiproject/multirelease-nine/src/test/java/mr/ATest.java index c86fc468..ef26fe6d 100644 --- a/src/it/multirelease-patterns/multiproject/multirelease-nine/src/test/java/mr/ATest.java +++ b/src/it/multirelease-patterns/multiproject/multirelease-nine/src/test/java/mr/ATest.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,35 +18,37 @@ * specific language governing permissions and limitations * under the License. */ -package mr; -import org.junit.Ignore; -import org.junit.Test; - -import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.junit.Assume.assumeThat; +import static org.hamcrest.CoreMatchers.is; -public class ATest { - - private static final String javaVersion = System.getProperty("java.version"); +import org.junit.Ignore; +import org.junit.Test; +public class ATest { + + private static final String javaVersion = System.getProperty( "java.version" ); + @Test - @Ignore("Maven module only creates Java 9 classes") - public void testGet8() throws Exception { - assumeThat(javaVersion, is("8")); - - assertThat(A.getString(), is("BASE -> 8")); - - assertThat(new A().introducedClass().getName(), is("java.time.LocalDateTime")); + @Ignore( "Maven module only creates Java 9 classes" ) + public void testGet8() throws Exception + { + assumeThat( javaVersion, is( "8" ) ); + + assertThat( A.getString(), is( "BASE -> 8" ) ); + + assertThat( new A().introducedClass().getName(), is( "java.time.LocalDateTime" ) ); } - + @Test - public void testGet9() throws Exception { - // assumeThat( javaVersion, is( "9" ) ); + public void testGet9() throws Exception + { +// assumeThat( javaVersion, is( "9" ) ); - assertThat(A.getString(), is("BASE -> 9")); + assertThat( A.getString(), is( "BASE -> 9" ) ); - assertThat(new A().introducedClass().getName(), is("java.lang.Module")); + assertThat( new A().introducedClass().getName(), is( "java.lang.Module" ) ); } -} + +} \ No newline at end of file diff --git a/src/it/multirelease-patterns/multiproject/pom.xml b/src/it/multirelease-patterns/multiproject/pom.xml index 79740d27..533282fd 100644 --- a/src/it/multirelease-patterns/multiproject/pom.xml +++ b/src/it/multirelease-patterns/multiproject/pom.xml @@ -35,20 +35,10 @@ maven-compiler-plugin @project.version@ - - org.apache.maven.plugins - maven-dependency-plugin - @version.maven-dependency-plugin@ - - - org.apache.maven.plugins - maven-jar-plugin - @version.maven-jar-plugin@ - org.apache.maven.plugins maven-surefire-plugin - @version.maven-surefire@ + 2.22.0 diff --git a/src/it/multirelease-patterns/packaging-plugin/pom.xml b/src/it/multirelease-patterns/packaging-plugin/pom.xml index 88fde2d5..41735132 100644 --- a/src/it/multirelease-patterns/packaging-plugin/pom.xml +++ b/src/it/multirelease-patterns/packaging-plugin/pom.xml @@ -33,7 +33,7 @@ org.apache.maven.plugins maven-surefire-plugin - @version.maven-surefire@ + 2.21.0 true @@ -56,7 +56,7 @@ org.apache.maven.plugins maven-failsafe-plugin - @version.maven-surefire@ + 2.21.0 @@ -78,7 +78,7 @@ junit junit - 4.13.1 + 4.12 test diff --git a/src/it/multirelease-patterns/packaging-plugin/src/main/java-mr/9/module-info.java b/src/it/multirelease-patterns/packaging-plugin/src/main/java-mr/9/module-info.java index 36f00e07..2407e6b1 100644 --- a/src/it/multirelease-patterns/packaging-plugin/src/main/java-mr/9/module-info.java +++ b/src/it/multirelease-patterns/packaging-plugin/src/main/java-mr/9/module-info.java @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -module example.mrjar { - exports base; - exports mr; +module example.mrjar +{ + exports base; + exports mr; } diff --git a/src/it/multirelease-patterns/packaging-plugin/src/main/java-mr/9/mr/A.java b/src/it/multirelease-patterns/packaging-plugin/src/main/java-mr/9/mr/A.java index 5083e1ce..e2b9598e 100644 --- a/src/it/multirelease-patterns/packaging-plugin/src/main/java-mr/9/mr/A.java +++ b/src/it/multirelease-patterns/packaging-plugin/src/main/java-mr/9/mr/A.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,17 +18,17 @@ * specific language governing permissions and limitations * under the License. */ -package mr; - -import java.util.Optional; import base.Base; -public class A implements I { +import java.util.Optional; + +public class A implements I +{ public static String getString() { - return Base.get() + " -> " + Optional.of("9").get(); + return Base.get() + " -> " + Optional.of( "9" ).get(); } - + @Override public Class introducedClass() { return Module.class; diff --git a/src/it/multirelease-patterns/packaging-plugin/src/main/java/base/Base.java b/src/it/multirelease-patterns/packaging-plugin/src/main/java/base/Base.java index 19ec7d8f..513f9099 100644 --- a/src/it/multirelease-patterns/packaging-plugin/src/main/java/base/Base.java +++ b/src/it/multirelease-patterns/packaging-plugin/src/main/java/base/Base.java @@ -1,3 +1,5 @@ +package base; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package base; public class Base { diff --git a/src/it/multirelease-patterns/packaging-plugin/src/main/java/mr/A.java b/src/it/multirelease-patterns/packaging-plugin/src/main/java/mr/A.java index 0e48eee6..6c2eb86b 100644 --- a/src/it/multirelease-patterns/packaging-plugin/src/main/java/mr/A.java +++ b/src/it/multirelease-patterns/packaging-plugin/src/main/java/mr/A.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,15 +18,15 @@ * specific language governing permissions and limitations * under the License. */ -package mr; import base.Base; -public class A implements I { +public class A implements I +{ public static String getString() { return Base.get() + " -> 8"; } - + @Override public Class introducedClass() { return java.time.LocalDateTime.class; diff --git a/src/it/multirelease-patterns/packaging-plugin/src/main/java/mr/I.java b/src/it/multirelease-patterns/packaging-plugin/src/main/java/mr/I.java index a0523266..f9858cfc 100644 --- a/src/it/multirelease-patterns/packaging-plugin/src/main/java/mr/I.java +++ b/src/it/multirelease-patterns/packaging-plugin/src/main/java/mr/I.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,8 +18,8 @@ * specific language governing permissions and limitations * under the License. */ -package mr; -public interface I { +public interface I +{ Class introducedClass(); -} +} \ No newline at end of file diff --git a/src/it/multirelease-patterns/packaging-plugin/src/test/java/mr/ATest.java b/src/it/multirelease-patterns/packaging-plugin/src/test/java/mr/ATest.java index 510fb1c4..07a207ca 100644 --- a/src/it/multirelease-patterns/packaging-plugin/src/test/java/mr/ATest.java +++ b/src/it/multirelease-patterns/packaging-plugin/src/test/java/mr/ATest.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,33 +18,35 @@ * specific language governing permissions and limitations * under the License. */ -package mr; -import org.junit.Test; - -import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.junit.Assume.assumeThat; +import static org.hamcrest.CoreMatchers.is; -public class ATest { - - private static final String javaVersion = System.getProperty("java.version"); +import org.junit.Test; +public class ATest { + + private static final String javaVersion = System.getProperty( "java.version" ); + @Test - public void testGet8() throws Exception { - assumeThat(javaVersion, is("8")); + public void testGet8() throws Exception + { + assumeThat( javaVersion, is( "8" ) ); + + assertThat( A.getString(), is( "BASE -> 8" ) ); - assertThat(A.getString(), is("BASE -> 8")); - - assertThat(new A().introducedClass().getName(), is("java.time.LocalDateTime")); + assertThat( new A().introducedClass().getName(), is( "java.time.LocalDateTime" ) ); } - + @Test - public void testGet9() throws Exception { - assumeThat(javaVersion, is("9")); + public void testGet9() throws Exception + { + assumeThat( javaVersion, is( "9" ) ); - assertThat(A.getString(), is("BASE -> 9")); + assertThat( A.getString(), is( "BASE -> 9" ) ); - assertThat(new A().introducedClass().getName(), is("java.lang.Module")); + assertThat( new A().introducedClass().getName(), is( "java.lang.Module" ) ); } -} + +} \ No newline at end of file diff --git a/src/it/multirelease-patterns/singleproject-runtime/invoker.properties b/src/it/multirelease-patterns/singleproject-runtime/invoker.properties index a15f4d08..318b31a7 100644 --- a/src/it/multirelease-patterns/singleproject-runtime/invoker.properties +++ b/src/it/multirelease-patterns/singleproject-runtime/invoker.properties @@ -14,4 +14,5 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +invoker.java.version = 1.8+ invoker.goals = verify \ No newline at end of file diff --git a/src/it/multirelease-patterns/singleproject-runtime/pom.xml b/src/it/multirelease-patterns/singleproject-runtime/pom.xml index fb8647e3..a5be9ce8 100644 --- a/src/it/multirelease-patterns/singleproject-runtime/pom.xml +++ b/src/it/multirelease-patterns/singleproject-runtime/pom.xml @@ -38,20 +38,10 @@ 1.8 - - org.apache.maven.plugins - maven-jar-plugin - @version.maven-jar-plugin@ - - - org.apache.maven.plugins - maven-failsafe-plugin - @version.maven-surefire@ - org.apache.maven.plugins maven-surefire-plugin - @version.maven-surefire@ + 2.21.0 true @@ -64,6 +54,7 @@ org.apache.maven.plugins maven-failsafe-plugin + 2.21.0 diff --git a/src/it/multirelease-patterns/singleproject-runtime/src/main/java/base/Base.java b/src/it/multirelease-patterns/singleproject-runtime/src/main/java/base/Base.java index 19ec7d8f..513f9099 100644 --- a/src/it/multirelease-patterns/singleproject-runtime/src/main/java/base/Base.java +++ b/src/it/multirelease-patterns/singleproject-runtime/src/main/java/base/Base.java @@ -1,3 +1,5 @@ +package base; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package base; public class Base { diff --git a/src/it/multirelease-patterns/singleproject-runtime/src/main/java/mr/A.java b/src/it/multirelease-patterns/singleproject-runtime/src/main/java/mr/A.java index 0e48eee6..6c2eb86b 100644 --- a/src/it/multirelease-patterns/singleproject-runtime/src/main/java/mr/A.java +++ b/src/it/multirelease-patterns/singleproject-runtime/src/main/java/mr/A.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,15 +18,15 @@ * specific language governing permissions and limitations * under the License. */ -package mr; import base.Base; -public class A implements I { +public class A implements I +{ public static String getString() { return Base.get() + " -> 8"; } - + @Override public Class introducedClass() { return java.time.LocalDateTime.class; diff --git a/src/it/multirelease-patterns/singleproject-runtime/src/main/java/mr/I.java b/src/it/multirelease-patterns/singleproject-runtime/src/main/java/mr/I.java index a0523266..f9858cfc 100644 --- a/src/it/multirelease-patterns/singleproject-runtime/src/main/java/mr/I.java +++ b/src/it/multirelease-patterns/singleproject-runtime/src/main/java/mr/I.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,8 +18,8 @@ * specific language governing permissions and limitations * under the License. */ -package mr; -public interface I { +public interface I +{ Class introducedClass(); -} +} \ No newline at end of file diff --git a/src/it/multirelease-patterns/singleproject-runtime/src/main/java9/module-info.java b/src/it/multirelease-patterns/singleproject-runtime/src/main/java9/module-info.java index 36f00e07..2407e6b1 100644 --- a/src/it/multirelease-patterns/singleproject-runtime/src/main/java9/module-info.java +++ b/src/it/multirelease-patterns/singleproject-runtime/src/main/java9/module-info.java @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -module example.mrjar { - exports base; - exports mr; +module example.mrjar +{ + exports base; + exports mr; } diff --git a/src/it/multirelease-patterns/singleproject-runtime/src/main/java9/mr/A.java b/src/it/multirelease-patterns/singleproject-runtime/src/main/java9/mr/A.java index 5083e1ce..e2b9598e 100644 --- a/src/it/multirelease-patterns/singleproject-runtime/src/main/java9/mr/A.java +++ b/src/it/multirelease-patterns/singleproject-runtime/src/main/java9/mr/A.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,17 +18,17 @@ * specific language governing permissions and limitations * under the License. */ -package mr; - -import java.util.Optional; import base.Base; -public class A implements I { +import java.util.Optional; + +public class A implements I +{ public static String getString() { - return Base.get() + " -> " + Optional.of("9").get(); + return Base.get() + " -> " + Optional.of( "9" ).get(); } - + @Override public Class introducedClass() { return Module.class; diff --git a/src/it/multirelease-patterns/singleproject-runtime/src/test/java/mr/ATest.java b/src/it/multirelease-patterns/singleproject-runtime/src/test/java/mr/ATest.java index 510fb1c4..07a207ca 100644 --- a/src/it/multirelease-patterns/singleproject-runtime/src/test/java/mr/ATest.java +++ b/src/it/multirelease-patterns/singleproject-runtime/src/test/java/mr/ATest.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,33 +18,35 @@ * specific language governing permissions and limitations * under the License. */ -package mr; -import org.junit.Test; - -import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.junit.Assume.assumeThat; +import static org.hamcrest.CoreMatchers.is; -public class ATest { - - private static final String javaVersion = System.getProperty("java.version"); +import org.junit.Test; +public class ATest { + + private static final String javaVersion = System.getProperty( "java.version" ); + @Test - public void testGet8() throws Exception { - assumeThat(javaVersion, is("8")); + public void testGet8() throws Exception + { + assumeThat( javaVersion, is( "8" ) ); + + assertThat( A.getString(), is( "BASE -> 8" ) ); - assertThat(A.getString(), is("BASE -> 8")); - - assertThat(new A().introducedClass().getName(), is("java.time.LocalDateTime")); + assertThat( new A().introducedClass().getName(), is( "java.time.LocalDateTime" ) ); } - + @Test - public void testGet9() throws Exception { - assumeThat(javaVersion, is("9")); + public void testGet9() throws Exception + { + assumeThat( javaVersion, is( "9" ) ); - assertThat(A.getString(), is("BASE -> 9")); + assertThat( A.getString(), is( "BASE -> 9" ) ); - assertThat(new A().introducedClass().getName(), is("java.lang.Module")); + assertThat( new A().introducedClass().getName(), is( "java.lang.Module" ) ); } -} + +} \ No newline at end of file diff --git a/src/it/multirelease-patterns/singleproject-toolchains/invoker.properties b/src/it/multirelease-patterns/singleproject-toolchains/invoker.properties index 193b2ad7..3e89fdde 100644 --- a/src/it/multirelease-patterns/singleproject-toolchains/invoker.properties +++ b/src/it/multirelease-patterns/singleproject-toolchains/invoker.properties @@ -16,3 +16,5 @@ # under the License. invoker.goals = verify -Pmulti-jar invoker.toolchain.jdk.version=1.9 +# Due to toolchain support +invoker.maven.version = 3.3.1+ diff --git a/src/it/multirelease-patterns/singleproject-toolchains/pom.xml b/src/it/multirelease-patterns/singleproject-toolchains/pom.xml index 39197623..154f8ae6 100644 --- a/src/it/multirelease-patterns/singleproject-toolchains/pom.xml +++ b/src/it/multirelease-patterns/singleproject-toolchains/pom.xml @@ -44,7 +44,7 @@ org.apache.maven.plugins maven-toolchains-plugin - 3.1.0 + 1.1 @@ -114,7 +114,7 @@ org.apache.maven.plugins maven-failsafe-plugin - @version.maven-surefire@ + 2.21.0 @@ -200,7 +200,7 @@ maven-surefire-plugin - @version.maven-surefire@ + 2.21.0 ${env.JAVA_HOME}/bin/java @@ -245,7 +245,7 @@ org.apache.maven.plugins maven-jar-plugin - @version.maven-jar-plugin@ + 2.4 diff --git a/src/it/multirelease-patterns/singleproject-toolchains/src/main/java/base/Base.java b/src/it/multirelease-patterns/singleproject-toolchains/src/main/java/base/Base.java index 19ec7d8f..513f9099 100644 --- a/src/it/multirelease-patterns/singleproject-toolchains/src/main/java/base/Base.java +++ b/src/it/multirelease-patterns/singleproject-toolchains/src/main/java/base/Base.java @@ -1,3 +1,5 @@ +package base; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package base; public class Base { diff --git a/src/it/multirelease-patterns/singleproject-toolchains/src/main/java/mr/A.java b/src/it/multirelease-patterns/singleproject-toolchains/src/main/java/mr/A.java index 0e48eee6..6c2eb86b 100644 --- a/src/it/multirelease-patterns/singleproject-toolchains/src/main/java/mr/A.java +++ b/src/it/multirelease-patterns/singleproject-toolchains/src/main/java/mr/A.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,15 +18,15 @@ * specific language governing permissions and limitations * under the License. */ -package mr; import base.Base; -public class A implements I { +public class A implements I +{ public static String getString() { return Base.get() + " -> 8"; } - + @Override public Class introducedClass() { return java.time.LocalDateTime.class; diff --git a/src/it/multirelease-patterns/singleproject-toolchains/src/main/java/mr/I.java b/src/it/multirelease-patterns/singleproject-toolchains/src/main/java/mr/I.java index a0523266..f9858cfc 100644 --- a/src/it/multirelease-patterns/singleproject-toolchains/src/main/java/mr/I.java +++ b/src/it/multirelease-patterns/singleproject-toolchains/src/main/java/mr/I.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,8 +18,8 @@ * specific language governing permissions and limitations * under the License. */ -package mr; -public interface I { +public interface I +{ Class introducedClass(); -} +} \ No newline at end of file diff --git a/src/it/multirelease-patterns/singleproject-toolchains/src/main/java9/module-info.java b/src/it/multirelease-patterns/singleproject-toolchains/src/main/java9/module-info.java index 36f00e07..2407e6b1 100644 --- a/src/it/multirelease-patterns/singleproject-toolchains/src/main/java9/module-info.java +++ b/src/it/multirelease-patterns/singleproject-toolchains/src/main/java9/module-info.java @@ -16,7 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -module example.mrjar { - exports base; - exports mr; +module example.mrjar +{ + exports base; + exports mr; } diff --git a/src/it/multirelease-patterns/singleproject-toolchains/src/main/java9/mr/A.java b/src/it/multirelease-patterns/singleproject-toolchains/src/main/java9/mr/A.java index 5083e1ce..e2b9598e 100644 --- a/src/it/multirelease-patterns/singleproject-toolchains/src/main/java9/mr/A.java +++ b/src/it/multirelease-patterns/singleproject-toolchains/src/main/java9/mr/A.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,17 +18,17 @@ * specific language governing permissions and limitations * under the License. */ -package mr; - -import java.util.Optional; import base.Base; -public class A implements I { +import java.util.Optional; + +public class A implements I +{ public static String getString() { - return Base.get() + " -> " + Optional.of("9").get(); + return Base.get() + " -> " + Optional.of( "9" ).get(); } - + @Override public Class introducedClass() { return Module.class; diff --git a/src/it/multirelease-patterns/singleproject-toolchains/src/test/java/mr/ATest.java b/src/it/multirelease-patterns/singleproject-toolchains/src/test/java/mr/ATest.java index 510fb1c4..07a207ca 100644 --- a/src/it/multirelease-patterns/singleproject-toolchains/src/test/java/mr/ATest.java +++ b/src/it/multirelease-patterns/singleproject-toolchains/src/test/java/mr/ATest.java @@ -1,3 +1,5 @@ +package mr; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,33 +18,35 @@ * specific language governing permissions and limitations * under the License. */ -package mr; -import org.junit.Test; - -import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; import static org.junit.Assume.assumeThat; +import static org.hamcrest.CoreMatchers.is; -public class ATest { - - private static final String javaVersion = System.getProperty("java.version"); +import org.junit.Test; +public class ATest { + + private static final String javaVersion = System.getProperty( "java.version" ); + @Test - public void testGet8() throws Exception { - assumeThat(javaVersion, is("8")); + public void testGet8() throws Exception + { + assumeThat( javaVersion, is( "8" ) ); + + assertThat( A.getString(), is( "BASE -> 8" ) ); - assertThat(A.getString(), is("BASE -> 8")); - - assertThat(new A().introducedClass().getName(), is("java.time.LocalDateTime")); + assertThat( new A().introducedClass().getName(), is( "java.time.LocalDateTime" ) ); } - + @Test - public void testGet9() throws Exception { - assumeThat(javaVersion, is("9")); + public void testGet9() throws Exception + { + assumeThat( javaVersion, is( "9" ) ); - assertThat(A.getString(), is("BASE -> 9")); + assertThat( A.getString(), is( "BASE -> 9" ) ); - assertThat(new A().introducedClass().getName(), is("java.lang.Module")); + assertThat( new A().introducedClass().getName(), is( "java.lang.Module" ) ); } -} + +} \ No newline at end of file diff --git a/src/it/non-english-warnings/pom.xml b/src/it/non-english-warnings/pom.xml index efb74e80..aaadacd1 100644 --- a/src/it/non-english-warnings/pom.xml +++ b/src/it/non-english-warnings/pom.xml @@ -43,7 +43,7 @@ org.apache.maven.plugins maven-compiler-plugin - @project.version@ + @pom.version@ false true diff --git a/src/it/non-english-warnings/src/main/java/MyClass.java b/src/it/non-english-warnings/src/main/java/MyClass.java index 16ecae3e..22efe455 100644 --- a/src/it/non-english-warnings/src/main/java/MyClass.java +++ b/src/it/non-english-warnings/src/main/java/MyClass.java @@ -6,9 +6,9 @@ * 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 @@ -16,12 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class MyClass { +public class MyClass +{ - public static void main(String[] args) { + public static void main( String[] args ) + { // the date constructor is deprecated and will cause a warning - System.out.println(new java.util.Date(2010, 8, 29)); + System.out.println( new java.util.Date( 2010, 8, 29 ) ); } + } diff --git a/src/it/non-english-warnings/src/test/java/MyTest.java b/src/it/non-english-warnings/src/test/java/MyTest.java index b9427e90..1de5f624 100644 --- a/src/it/non-english-warnings/src/test/java/MyTest.java +++ b/src/it/non-english-warnings/src/test/java/MyTest.java @@ -6,9 +6,9 @@ * 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 @@ -16,12 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class MyTest { +public class MyTest +{ - public static void main(String[] args) { + public static void main( String[] args ) + { // the date constructor is deprecated and will cause a warning - System.out.println(new java.util.Date(2010, 8, 29)); + System.out.println( new java.util.Date( 2010, 8, 29 ) ); } + } diff --git a/src/it/non-english-warnings/verify.bsh b/src/it/non-english-warnings/verify.bsh index db162700..8b1bc6eb 100644 --- a/src/it/non-english-warnings/verify.bsh +++ b/src/it/non-english-warnings/verify.bsh @@ -16,19 +16,18 @@ * specific language governing permissions and limitations * under the License. */ -package foo; import java.io.*; import java.util.*; import java.util.regex.*; -File mainClass = new File( basedir, "target/classes/foo/MyClass.class" ); +File mainClass = new File( basedir, "target/classes/MyClass.class" ); if ( !mainClass.isFile() ) { throw new FileNotFoundException( "Main class not existent: " + mainClass ); } -File testClass = new File( basedir, "target/test-classes/foo/MyTest.class" ); +File testClass = new File( basedir, "target/test-classes/MyTest.class" ); if ( !testClass.isFile() ) { throw new FileNotFoundException( "Test class not existent: " + testClass ); diff --git a/src/it/release-without-profile-fork/invoker.properties b/src/it/release-without-profile-fork/invoker.properties deleted file mode 100644 index 0659ac55..00000000 --- a/src/it/release-without-profile-fork/invoker.properties +++ /dev/null @@ -1,18 +0,0 @@ -# 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 = compile diff --git a/src/it/release-without-profile-fork/pom.xml b/src/it/release-without-profile-fork/pom.xml deleted file mode 100644 index 529ceedb..00000000 --- a/src/it/release-without-profile-fork/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - 4.0.0 - org.apache.maven.plugins.compiler.it - release-without-profile-fork - 1.0-SNAPSHOT - - - - - org.apache.maven.plugins - maven-compiler-plugin - @project.version@ - - - 8 - 8 - 8 - true - - - - - - diff --git a/src/it/release-without-profile-fork/src/main/java/MyClass.java b/src/it/release-without-profile-fork/src/main/java/MyClass.java deleted file mode 100644 index d4132bb2..00000000 --- a/src/it/release-without-profile-fork/src/main/java/MyClass.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ -package foo; - -public class MyClass {} diff --git a/src/it/release-without-profile-fork/verify.groovy b/src/it/release-without-profile-fork/verify.groovy deleted file mode 100644 index e563b3d7..00000000 --- a/src/it/release-without-profile-fork/verify.groovy +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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. - */ -def logFile = new File(basedir, 'build.log') -assert logFile.exists() -content = logFile.text - -// for jdk 8 we will have target and source -def jdkTarget = content.contains(' -source 8') && content.contains(' -target 8') && !content.contains(' --release 8') - -// for jdk9+ we will have release only -def jdkRelease = !content.contains(' -source 8') && !content.contains(' -target 8') && content.contains(' --release 8') - -assert (jdkTarget && !jdkRelease) || (!jdkTarget && jdkRelease) diff --git a/src/it/release-without-profile/invoker.properties b/src/it/release-without-profile/invoker.properties deleted file mode 100644 index 0659ac55..00000000 --- a/src/it/release-without-profile/invoker.properties +++ /dev/null @@ -1,18 +0,0 @@ -# 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 = compile diff --git a/src/it/release-without-profile/pom.xml b/src/it/release-without-profile/pom.xml deleted file mode 100644 index ce58cab9..00000000 --- a/src/it/release-without-profile/pom.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - 4.0.0 - org.apache.maven.plugins.compiler.it - release-without-profile - 1.0-SNAPSHOT - - - - - org.apache.maven.plugins - maven-compiler-plugin - @project.version@ - - - 8 - 8 - 8 - - - - - - diff --git a/src/it/release-without-profile/src/main/java/MyClass.java b/src/it/release-without-profile/src/main/java/MyClass.java deleted file mode 100644 index d4132bb2..00000000 --- a/src/it/release-without-profile/src/main/java/MyClass.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * 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. - */ -package foo; - -public class MyClass {} diff --git a/src/it/release-without-profile/verify.groovy b/src/it/release-without-profile/verify.groovy deleted file mode 100644 index e563b3d7..00000000 --- a/src/it/release-without-profile/verify.groovy +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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. - */ -def logFile = new File(basedir, 'build.log') -assert logFile.exists() -content = logFile.text - -// for jdk 8 we will have target and source -def jdkTarget = content.contains(' -source 8') && content.contains(' -target 8') && !content.contains(' --release 8') - -// for jdk9+ we will have release only -def jdkRelease = !content.contains(' -source 8') && !content.contains(' -target 8') && content.contains(' --release 8') - -assert (jdkTarget && !jdkRelease) || (!jdkTarget && jdkRelease) diff --git a/src/it/settings.xml b/src/it/settings.xml index 0a5c986f..f4333950 100644 --- a/src/it/settings.xml +++ b/src/it/settings.xml @@ -32,17 +32,21 @@ under the License. @localRepositoryUrl@ true + ignore true + ignore false + ignore true + ignore plexus-snapshots Plexus Snapshot Repository @@ -55,9 +59,11 @@ under the License. @localRepositoryUrl@ true + ignore true + ignore diff --git a/src/it/setup_annotation-verify-plugin/invoker.properties b/src/it/setup_annotation-verify-plugin/invoker.properties deleted file mode 100644 index d5d6ca5d..00000000 --- a/src/it/setup_annotation-verify-plugin/invoker.properties +++ /dev/null @@ -1,18 +0,0 @@ -# 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 = install diff --git a/src/it/setup_annotation-verify-plugin/pom.xml b/src/it/setup_annotation-verify-plugin/pom.xml deleted file mode 100644 index 206df9b5..00000000 --- a/src/it/setup_annotation-verify-plugin/pom.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - 4.0.0 - - org.apache.maven.plugins.compiler.it - annotation-verify-plugin - 1.0.0-SNAPSHOT - maven-plugin - - - - org.apache.maven.plugin-tools - maven-plugin-annotations - @version.maven-plugin-tools@ - provided - - - org.apache.maven - maven-plugin-api - @mavenVersion@ - provided - - - org.apache.maven - maven-artifact - @mavenVersion@ - provided - - - org.apache.maven - maven-core - @mavenVersion@ - provided - - - org.apache.maven.reporting - maven-reporting-api - - - org.apache.maven.wagon - wagon-file - - - org.apache.maven.wagon - wagon-http-lightweight - - - org.apache.maven.wagon - wagon-ssh - - - org.apache.maven.wagon - wagon-ssh-external - - - commons-cli - commons-cli - - - classworlds - classworlds - - - org.codehaus.plexus - plexus-container-default - - - org.codehaus.plexus - plexus-interactivity-api - - - - - - - - - - org.apache.maven.plugins - maven-plugin-plugin - @version.maven-plugin-tools@ - - annotation-verify - - - - - - diff --git a/src/it/setup_annotation-verify-plugin/src/main/java/org.apache.maven.plugins.compiler.it/SourcePathReadGoal.java b/src/it/setup_annotation-verify-plugin/src/main/java/org.apache.maven.plugins.compiler.it/SourcePathReadGoal.java deleted file mode 100644 index 46b7d2b6..00000000 --- a/src/it/setup_annotation-verify-plugin/src/main/java/org.apache.maven.plugins.compiler.it/SourcePathReadGoal.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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. - */ -package org.apache.maven.plugins.compiler.it; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.util.List; - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -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.project.MavenProject; - -@Mojo(name = "read-source", defaultPhase = LifecyclePhase.PROCESS_TEST_CLASSES) -public class SourcePathReadGoal extends AbstractMojo { - - @Parameter - protected String sourceClass; - - @Parameter - protected String testSourceClass; - - @Parameter(defaultValue = "${project}") - protected MavenProject project; - - @SuppressWarnings("unchecked") - public void execute() throws MojoExecutionException, MojoFailureException { - if (sourceClass != null) { - getLog().info("Checking compile source roots for: '" + sourceClass + "'"); - assertGeneratedSourceFileFor(sourceClass, project.getCompileSourceRoots()); - } - - if (testSourceClass != null) { - getLog().info("Checking test-compile source roots for: '" + testSourceClass + "'"); - assertGeneratedSourceFileFor(testSourceClass, project.getTestCompileSourceRoots()); - } - } - - private void assertGeneratedSourceFileFor(String sourceClass, List sourceRoots) - throws MojoFailureException, MojoExecutionException { - String sourceFile = sourceClass.replace('.', '/').concat(".txt"); - - boolean found = false; - for (String root : sourceRoots) { - File f = new File(root, sourceFile); - getLog().info("Looking for: " + f); - if (f.exists()) { - try { - String[] nameParts = sourceClass.split("\\."); - String content = new String(Files.readAllBytes(f.toPath())); - if (!nameParts[nameParts.length - 1].equals(content)) { - throw new MojoFailureException("Non-matching content in: " + f + "\n expected: '" + sourceClass - + "'\n found: '" + content + "'"); - } - found = true; - break; - } catch (IOException e) { - throw new MojoExecutionException("Cannot read contents of: " + f, e); - } - } - } - - if (!found) { - throw new MojoFailureException( - "Cannot find generated source file: " + sourceFile + " in:\n " + String.join("\n ", sourceRoots)); - } - } -} diff --git a/src/it/setup_jar_automodule/pom.xml b/src/it/setup_jar_automodule/pom.xml index 8cac6607..b20e48b2 100644 --- a/src/it/setup_jar_automodule/pom.xml +++ b/src/it/setup_jar_automodule/pom.xml @@ -44,7 +44,7 @@ org.apache.maven.plugins maven-jar-plugin - @version.maven-jar-plugin@ + 3.0.2 diff --git a/src/it/setup_jar_automodule/src/main/java/com/ta3/MyClass.java b/src/it/setup_jar_automodule/src/main/java/com/ta3/MyClass.java index 728c244a..e6cbd8bd 100644 --- a/src/it/setup_jar_automodule/src/main/java/com/ta3/MyClass.java +++ b/src/it/setup_jar_automodule/src/main/java/com/ta3/MyClass.java @@ -1,21 +1,25 @@ -/* - * 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. - */ -package com.ta3; - -public class MyClass {} +package com.ta3; + +/* + * 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/setup_jar_module/src/main/java/com/ta2/MyClass.java b/src/it/setup_jar_module/src/main/java/com/ta2/MyClass.java index 5d1cc1fa..4309cae8 100644 --- a/src/it/setup_jar_module/src/main/java/com/ta2/MyClass.java +++ b/src/it/setup_jar_module/src/main/java/com/ta2/MyClass.java @@ -1,21 +1,25 @@ -/* - * 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. - */ -package com.ta2; - -public class MyClass {} +package com.ta2; + +/* + * 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/setup_jar_module/src/main/java/module-info.java b/src/it/setup_jar_module/src/main/java/module-info.java index 11a00624..85677180 100644 --- a/src/it/setup_jar_module/src/main/java/module-info.java +++ b/src/it/setup_jar_module/src/main/java/module-info.java @@ -1,22 +1,24 @@ -/* - * 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. - */ - -module ta2 { - exports com.ta2; -} +/* + * 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. + */ + +module ta2 { + + exports com.ta2; + +} \ No newline at end of file diff --git a/src/it/setup_x/setup_jar_classic/src/main/java/com/ta2/MyClass.java b/src/it/setup_x/setup_jar_classic/src/main/java/com/ta2/MyClass.java index 5d1cc1fa..4309cae8 100644 --- a/src/it/setup_x/setup_jar_classic/src/main/java/com/ta2/MyClass.java +++ b/src/it/setup_x/setup_jar_classic/src/main/java/com/ta2/MyClass.java @@ -1,21 +1,25 @@ -/* - * 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. - */ -package com.ta2; - -public class MyClass {} +package com.ta2; + +/* + * 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/setup_x/setup_module-transitive/src/main/java/com/ta2/plus/MyClass.java b/src/it/setup_x/setup_module-transitive/src/main/java/com/ta2/plus/MyClass.java index 2ec4f195..ce9abfee 100644 --- a/src/it/setup_x/setup_module-transitive/src/main/java/com/ta2/plus/MyClass.java +++ b/src/it/setup_x/setup_module-transitive/src/main/java/com/ta2/plus/MyClass.java @@ -1,21 +1,25 @@ -/* - * 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. - */ -package com.ta2.plus; - -public class MyClass {} +package com.ta2.plus; + +/* + * 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/setup_x/setup_module-transitive/src/main/java/module-info.java b/src/it/setup_x/setup_module-transitive/src/main/java/module-info.java index bf7ff9d6..642a635d 100644 --- a/src/it/setup_x/setup_module-transitive/src/main/java/module-info.java +++ b/src/it/setup_x/setup_module-transitive/src/main/java/module-info.java @@ -1,22 +1,24 @@ -/* - * 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. - */ - -module ta2.plus { - exports com.ta2.plus; -} +/* + * 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. + */ + +module ta2.plus { + + exports com.ta2.plus; + +} \ No newline at end of file diff --git a/src/it/test1/src/main/java/MyClass.java b/src/it/test1/src/main/java/MyClass.java index d4132bb2..4945381a 100644 --- a/src/it/test1/src/main/java/MyClass.java +++ b/src/it/test1/src/main/java/MyClass.java @@ -6,9 +6,9 @@ * 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 @@ -16,6 +16,8 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class MyClass {} +public class MyClass +{ + +} 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 2dc4ddb8..32cfbc19 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java +++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java @@ -26,46 +26,37 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.time.Instant; -import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; -import java.util.Comparator; -import java.util.Date; import java.util.HashSet; import java.util.Iterator; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Optional; import java.util.Properties; import java.util.Set; import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.apache.maven.RepositoryUtils; -import org.apache.maven.artifact.handler.ArtifactHandler; -import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager; -import org.apache.maven.execution.MavenExecutionRequest; -import org.apache.maven.execution.MavenSession; -import org.apache.maven.model.Dependency; -import org.apache.maven.model.DependencyManagement; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecution; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugins.annotations.Component; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; -import org.apache.maven.shared.incremental.IncrementalBuildHelper; -import org.apache.maven.shared.incremental.IncrementalBuildHelperRequest; -import org.apache.maven.shared.utils.StringUtils; -import org.apache.maven.shared.utils.logging.MessageBuilder; -import org.apache.maven.shared.utils.logging.MessageUtils; -import org.apache.maven.toolchain.Toolchain; -import org.apache.maven.toolchain.ToolchainManager; + +import org.apache.maven.api.*; +import org.apache.maven.api.di.Inject; +import org.apache.maven.api.plugin.Log; +import org.apache.maven.api.plugin.Mojo; +import org.apache.maven.api.plugin.MojoException; +import org.apache.maven.api.plugin.annotations.Parameter; +import org.apache.maven.api.services.ArtifactManager; +import org.apache.maven.api.services.DependencyCoordinateFactory; +import org.apache.maven.api.services.DependencyCoordinateFactoryRequest; +import org.apache.maven.api.services.DependencyResolver; +import org.apache.maven.api.services.DependencyResolverRequest; +import org.apache.maven.api.services.MessageBuilder; +import org.apache.maven.api.services.MessageBuilderFactory; +import org.apache.maven.api.services.ProjectManager; +import org.apache.maven.api.services.ToolchainManager; import org.codehaus.plexus.compiler.Compiler; import org.codehaus.plexus.compiler.CompilerConfiguration; +import org.codehaus.plexus.compiler.CompilerError; import org.codehaus.plexus.compiler.CompilerException; import org.codehaus.plexus.compiler.CompilerMessage; import org.codehaus.plexus.compiler.CompilerOutputStyle; @@ -79,16 +70,12 @@ import org.codehaus.plexus.compiler.util.scan.mapping.SuffixMapping; import org.codehaus.plexus.languages.java.jpms.JavaModuleDescriptor; import org.codehaus.plexus.languages.java.version.JavaVersion; +import org.codehaus.plexus.logging.AbstractLogger; +import org.codehaus.plexus.logging.LogEnabled; +import org.codehaus.plexus.logging.Logger; import org.codehaus.plexus.util.FileUtils; -import org.eclipse.aether.RepositorySystem; -import org.eclipse.aether.artifact.Artifact; -import org.eclipse.aether.artifact.ArtifactTypeRegistry; -import org.eclipse.aether.artifact.DefaultArtifact; -import org.eclipse.aether.collection.CollectRequest; -import org.eclipse.aether.graph.Exclusion; -import org.eclipse.aether.resolution.DependencyRequest; -import org.eclipse.aether.resolution.DependencyResult; -import org.eclipse.aether.util.artifact.JavaScopes; +import org.codehaus.plexus.util.ReaderFactory; +import org.codehaus.plexus.util.StringUtils; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Opcodes; @@ -102,7 +89,7 @@ * @author Trygve Laugstøl * @since 2.0 */ -public abstract class AbstractCompilerMojo extends AbstractMojo { +public abstract class AbstractCompilerMojo implements Mojo { protected static final String PS = System.getProperty("path.separator"); private static final String INPUT_FILES_LST_FILENAME = "inputFiles.lst"; @@ -111,6 +98,9 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { static final String DEFAULT_TARGET = "1.8"; + // Used to compare with older targets + static final String MODULE_INFO_TARGET = "1.9"; + // ---------------------------------------------------------------------- // Configurables // ---------------------------------------------------------------------- @@ -121,7 +111,7 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { * @since 2.0.2 */ @Parameter(property = "maven.compiler.failOnError", defaultValue = "true") - private boolean failOnError = true; + protected boolean failOnError = true; /** * Indicates whether the build will continue even if there are compilation warnings. @@ -129,45 +119,39 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { * @since 3.6 */ @Parameter(property = "maven.compiler.failOnWarning", defaultValue = "false") - private boolean failOnWarning; + protected boolean failOnWarning; /** * Set to true to include debugging information in the compiled class files. - * @see javac -g - * @see #debuglevel */ @Parameter(property = "maven.compiler.debug", defaultValue = "true") - private boolean debug = true; + protected boolean debug = true; /** * Set to true to generate metadata for reflection on method parameters. * @since 3.6.2 - * @see javac -parameters */ @Parameter(property = "maven.compiler.parameters", defaultValue = "false") - private boolean parameters; + protected boolean parameters; /** - * Set to true to enable preview language features of the java compiler + * Set to true to Enable preview language features of the java compiler * @since 3.10.1 - * @see javac --enable-preview */ @Parameter(property = "maven.compiler.enablePreview", defaultValue = "false") - private boolean enablePreview; + protected boolean enablePreview; /** * Set to true to show messages about what the compiler is doing. - * - * @see javac -verbose */ @Parameter(property = "maven.compiler.verbose", defaultValue = "false") - private boolean verbose; + protected boolean verbose; /** * Sets whether to show source locations where deprecated APIs are used. */ @Parameter(property = "maven.compiler.showDeprecation", defaultValue = "false") - private boolean showDeprecation; + protected boolean showDeprecation; /** * Set to true to optimize the compiled code using the compiler's optimization methods. @@ -175,86 +159,74 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { */ @Deprecated @Parameter(property = "maven.compiler.optimize", defaultValue = "false") - private boolean optimize; + protected boolean optimize; /** - * Set to false to disable warnings during compilation. + * Set to true to show compilation warnings. */ - @Parameter(property = "maven.compiler.showWarnings", defaultValue = "true") - private boolean showWarnings; + @Parameter(property = "maven.compiler.showWarnings", defaultValue = "false") + protected boolean showWarnings; /** - *

The {@code -source} argument for the Java compiler.

+ *

The -source argument for the Java compiler.

* - *

NOTE:

- *

Since 3.8.0 the default value has changed from 1.5 to 1.6

- *

Since 3.9.0 the default value has changed from 1.6 to 1.7

- *

Since 3.11.0 the default value has changed from 1.7 to 1.8

- * @see javac -source + * NOTE: Since 3.8.0 the default value has changed from 1.5 to 1.6. + * Since 3.9.0 the default value has changed from 1.6 to 1.7 */ @Parameter(property = "maven.compiler.source", defaultValue = DEFAULT_SOURCE) protected String source; /** - *

The {@code -target} argument for the Java compiler.

- * - *

NOTE:

- *

Since 3.8.0 the default value has changed from 1.5 to 1.6

- *

Since 3.9.0 the default value has changed from 1.6 to 1.7

- *

Since 3.11.0 the default value has changed from 1.7 to 1.8

+ *

The -target argument for the Java compiler.

* - * @see javac -target + * NOTE: Since 3.8.0 the default value has changed from 1.5 to 1.6. + * Since 3.9.0 the default value has changed from 1.6 to 1.7 */ @Parameter(property = "maven.compiler.target", defaultValue = DEFAULT_TARGET) protected String target; /** - * The {@code -release} argument for the Java compiler, supported since Java9 + * The -release argument for the Java compiler, supported since Java9 * * @since 3.6 - * @see javac -release */ @Parameter(property = "maven.compiler.release") protected String release; /** - * The {@code -encoding} argument for the Java compiler. + * The -encoding argument for the Java compiler. * * @since 2.1 - * @see javac -encoding */ @Parameter(property = "encoding", defaultValue = "${project.build.sourceEncoding}") - private String encoding; + protected String encoding; /** * Sets the granularity in milliseconds of the last modification * date for testing whether a source needs recompilation. */ @Parameter(property = "lastModGranularityMs", defaultValue = "0") - private int staleMillis; + protected int staleMillis; /** * The compiler id of the compiler to use. See this * guide for more information. */ @Parameter(property = "maven.compiler.compilerId", defaultValue = "javac") - private String compilerId; + protected String compilerId; /** * Version of the compiler to use, ex. "1.3", "1.5", if {@link #fork} is set to true. - * @deprecated This parameter is no longer evaluated by the underlying compilers, instead the actual - * version of the {@code javac} binary is automatically retrieved. */ - @Deprecated @Parameter(property = "maven.compiler.compilerVersion") - private String compilerVersion; + protected String compilerVersion; /** * Allows running the compiler in a separate process. * If false it uses the built in compiler, while if true it will use an executable. */ @Parameter(property = "maven.compiler.fork", defaultValue = "false") - private boolean fork; + protected boolean fork; /** * Initial size, in megabytes, of the memory allocation pool, ex. "64", "64m" @@ -263,7 +235,7 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { * @since 2.0.1 */ @Parameter(property = "maven.compiler.meminitial") - private String meminitial; + protected String meminitial; /** * Sets the maximum size, in megabytes, of the memory allocation pool, ex. "128", "128m" @@ -272,13 +244,13 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { * @since 2.0.1 */ @Parameter(property = "maven.compiler.maxmem") - private String maxmem; + protected String maxmem; /** * Sets the executable of the compiler to use when {@link #fork} is true. */ @Parameter(property = "maven.compiler.executable") - private String executable; + protected String executable; /** *

@@ -289,17 +261,12 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { *

    *
  • none - no annotation processing is performed.
  • *
  • only - only annotation processing is done, no compilation.
  • - *
  • full - annotation processing and compilation.
  • *
* - * full is the default. Starting with JDK 21, this option must be set explicitly. - * * @since 2.2 - * @see javac -proc - * @see javac Annotation Processing */ - @Parameter(property = "maven.compiler.proc") - private String proc; + @Parameter + protected String proc; /** *

@@ -308,11 +275,9 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { *

* * @since 2.2 - * @see javac -processor - * @see javac Annotation Processing */ @Parameter - private String[] annotationProcessors; + protected String[] annotationProcessors; /** *

@@ -322,7 +287,7 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { *

*

* Each classpath element is specified using their Maven coordinates (groupId, artifactId, version, classifier, - * type). Transitive dependencies are added automatically. Exclusions are supported as well. Example: + * type). Transitive dependencies are added automatically. Example: *

* *
@@ -331,75 +296,17 @@ public abstract class AbstractCompilerMojo extends AbstractMojo {
      *     <path>
      *       <groupId>org.sample</groupId>
      *       <artifactId>sample-annotation-processor</artifactId>
-     *       <version>1.2.3</version> <!-- Optional - taken from dependency management if not specified -->
-     *       <!-- Optionally exclude transitive dependencies -->
-     *       <exclusions>
-     *         <exclusion>
-     *           <groupId>org.sample</groupId>
-     *           <artifactId>sample-dependency</artifactId>
-     *         </exclusion>
-     *       </exclusions>
+     *       <version>1.2.3</version>
      *     </path>
      *     <!-- ... more ... -->
      *   </annotationProcessorPaths>
      * </configuration>
      * 
* - * Note: Exclusions are supported from version 3.11.0. - * * @since 3.5 - * @see javac -processorpath - * @see javac Annotation Processing - * - */ - @Parameter - private List annotationProcessorPaths; - - /** - *

- * Whether to use the Maven dependency management section when resolving transitive dependencies of annotation - * processor paths. - *

- *

- * This flag does not enable / disable the ability to resolve the version of annotation processor paths - * from dependency management section. It only influences the resolution of transitive dependencies of those - * top-level paths. - *

- * - * @since 3.12.0 - */ - @Parameter(defaultValue = "false") - private boolean annotationProcessorPathsUseDepMgmt; - - /** - *

- * Sets the arguments to be passed to the compiler (prepending a dash). - *

- *

- * This is because the list of valid arguments passed to a Java compiler varies based on the compiler version. - *

- *

- * Note that {@code -J} options are only passed through if {@link #fork} is set to {@code true}. - *

- *

- * To pass -Xmaxerrs 1000 -Xlint -Xlint:-path -Averbose=true you should include the following: - *

- * - *
-     * <compilerArguments>
-     *   <Xmaxerrs>1000</Xmaxerrs>
-     *   <Xlint/>
-     *   <Xlint:-path/>
-     *   <Averbose>true</Averbose>
-     * </compilerArguments>
-     * 
- * - * @since 2.0.1 - * @deprecated use {@link #compilerArgs} instead. */ @Parameter - @Deprecated - protected Map compilerArguments; + protected List annotationProcessorPaths; /** *

@@ -419,7 +326,6 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { * * * @since 3.1 - * @see javac -J */ @Parameter protected List compilerArgs; @@ -435,7 +341,6 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { *

* Note that {@code -J} options are only passed through if {@link #fork} is set to {@code true}. *

- * @see javac -J */ @Parameter protected String compilerArgument; @@ -453,10 +358,9 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { * Keyword list to be appended to the -g command-line switch. Legal values are none or a * comma-separated list of the following keywords: lines, vars, and source. * If debug level is not specified, by default, nothing will be appended to -g. - * If {@link #debug} is not turned on, this attribute will be ignored. + * If debug is not turned on, this attribute will be ignored. * * @since 2.1 - * @see javac -G:[lines,vars,source] */ @Parameter(property = "maven.compiler.debuglevel") private String debuglevel; @@ -465,16 +369,9 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { * Keyword to be appended to the -implicit: command-line switch. * * @since 3.10.2 - * @see javac -implicit */ @Parameter(property = "maven.compiler.implicit") - private String implicit; - - /** - * - */ - @Component - private ToolchainManager toolchainManager; + protected String implicit; /** *

@@ -506,7 +403,7 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { * @since 3.6 */ @Parameter - private Map jdkToolchain; + protected Map jdkToolchain; // ---------------------------------------------------------------------- // Read-only parameters @@ -515,33 +412,35 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { /** * The directory to run the compiler from if fork is true. */ - @Parameter(defaultValue = "${basedir}", required = true, readonly = true) - private File basedir; + @Parameter(defaultValue = "${project.basedir}", required = true, readonly = true) + protected Path basedir; /** * The target directory of the compiler if fork is true. */ @Parameter(defaultValue = "${project.build.directory}", required = true, readonly = true) - private File buildDirectory; + protected Path buildDirectory; + + @Parameter /** * Plexus compiler manager. */ - @Component - private CompilerManager compilerManager; + @Inject + protected CompilerManager compilerManager; /** * The current build session instance. This is used for toolchain manager API calls. */ - @Parameter(defaultValue = "${session}", readonly = true, required = true) - private MavenSession session; + @Inject + protected Session session; /** * The current project instance. This is used for propagating generated-sources paths as compile/testCompile source * roots. */ - @Parameter(defaultValue = "${project}", readonly = true, required = true) - private MavenProject project; + @Inject + protected Project project; /** * Strategy to re use javacc class created: @@ -557,50 +456,34 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { * @since 2.5 */ @Parameter(defaultValue = "${reuseCreated}", property = "maven.compiler.compilerReuseStrategy") - private String compilerReuseStrategy = "reuseCreated"; + protected String compilerReuseStrategy = "reuseCreated"; /** * @since 2.5 */ @Parameter(defaultValue = "false", property = "maven.compiler.skipMultiThreadWarning") - private boolean skipMultiThreadWarning; + protected boolean skipMultiThreadWarning; /** - * Legacy parameter name of {@link #forceLegacyJavacApi}. Only considered if {@link #forceLegacyJavacApi} is - * not set or {@code false}. + * compiler can now use javax.tools if available in your current jdk, you can disable this feature + * using -Dmaven.compiler.forceJavacCompilerUse=true or in the plugin configuration + * * @since 3.0 - * @deprecated Use {@link #forceLegacyJavacApi} instead */ - @Deprecated @Parameter(defaultValue = "false", property = "maven.compiler.forceJavacCompilerUse") - private boolean forceJavacCompilerUse; + protected boolean forceJavacCompilerUse; - /** - * The underlying compiler now uses {@code javax.tools} API - * if available in your current JDK. - * Set this to {@code true} to always use the legacy - * {@code com.sun.tools.javac} API instead. - *

- * This only has an effect for {@link #compilerId} being {@code javac} and {@link #fork} being {@code false}. - * - * @since 3.13 - */ - @Parameter(defaultValue = "false", property = "maven.compiler.forceLegacyJavacApi") - private boolean forceLegacyJavacApi; - - /** - * @since 3.0 needed for storing the status for the incremental build support. - */ - @Parameter(defaultValue = "${mojoExecution}", readonly = true, required = true) - private MojoExecution mojoExecution; + @Parameter(defaultValue = "maven-status/${mojo.plugin.descriptor.id}/${mojo.goal}/${mojo.executionId}") + protected String mojoStatusPath; /** * File extensions to check timestamp for incremental build. + * Default contains only class and jar. * * @since 3.1 */ - @Parameter(defaultValue = "class,jar") - private Set fileExtensions; + @Parameter + protected List fileExtensions; /** *

to enable/disable incremental compilation feature.

@@ -619,7 +502,7 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { * @since 3.1 */ @Parameter(defaultValue = "true", property = "maven.compiler.useIncrementalCompilation") - private boolean useIncrementalCompilation = true; + protected boolean useIncrementalCompilation = true; /** * Package info source files that only contain javadoc and no annotation on the package @@ -631,10 +514,10 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { * @since 3.10 */ @Parameter(defaultValue = "true", property = "maven.compiler.createMissingPackageInfoClass") - private boolean createMissingPackageInfoClass = true; + protected boolean createMissingPackageInfoClass = true; @Parameter(defaultValue = "false", property = "maven.compiler.showCompilationChanges") - private boolean showCompilationChanges = false; + protected boolean showCompilationChanges = false; /** * Timestamp for reproducible output archive entries, either formatted as ISO 8601 @@ -643,19 +526,22 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { * @since 3.12.0 */ @Parameter(defaultValue = "${project.build.outputTimestamp}") - private String outputTimestamp; + protected String outputTimestamp; - /** - * Resolves the artifacts needed. - */ - @Component - private RepositorySystem repositorySystem; + @Inject + protected ProjectManager projectManager; - /** - * Artifact handler manager. - */ - @Component - private ArtifactHandlerManager artifactHandlerManager; + @Inject + protected ArtifactManager artifactManager; + + @Inject + protected ToolchainManager toolchainManager; + + @Inject + protected MessageBuilderFactory messageBuilderFactory; + + @Inject + protected Log logger; protected abstract SourceInclusionScanner getSourceInclusionScanner(int staleMillis); @@ -667,11 +553,11 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { protected abstract Map getPathElements(); - protected abstract List getCompileSourceRoots(); + protected abstract List getCompileSourceRoots(); - protected abstract void preparePaths(Set sourceFiles); + protected abstract void preparePaths(Set sourceFiles); - protected abstract File getOutputDirectory(); + protected abstract Path getOutputDirectory(); protected abstract String getSource(); @@ -681,29 +567,18 @@ public abstract class AbstractCompilerMojo extends AbstractMojo { protected abstract String getCompilerArgument(); - protected abstract Map getCompilerArguments(); - - protected abstract File getGeneratedSourcesDirectory(); + protected abstract Path getGeneratedSourcesDirectory(); protected abstract String getDebugFileName(); - protected final MavenProject getProject() { + protected final Project getProject() { return project; } - protected final Optional getModuleDeclaration(final Set sourceFiles) { - for (File sourceFile : sourceFiles) { - if ("module-info.java".equals(sourceFile.getName())) { - return Optional.of(sourceFile.toPath()); - } - } - return Optional.empty(); - } - private boolean targetOrReleaseSet; @Override - public void execute() throws MojoExecutionException, CompilationFailureException { + public void execute() { // ---------------------------------------------------------------------- // Look up the compiler. This is done before other code than can // cause the mojo to return before the lookup is done possibly resulting @@ -716,38 +591,41 @@ public void execute() throws MojoExecutionException, CompilationFailureException try { compiler = compilerManager.getCompiler(compilerId); + if (compiler instanceof LogEnabled) { + ((LogEnabled) compiler).enableLogging(new MavenLogger()); + } } catch (NoSuchCompilerException e) { - throw new MojoExecutionException("No such compiler '" + e.getCompilerId() + "'.", e); + throw new MojoException("No such compiler '" + e.getCompilerId() + "'."); } // -----------toolchains start here ---------------------------------- // use the compilerId as identifier for toolchains as well. - Toolchain tc = getToolchain(); - if (tc != null) { + Optional tc = getToolchain(); + if (tc.isPresent()) { getLog().info("Toolchain in maven-compiler-plugin: " + tc); if (executable != null) { getLog().warn("Toolchains are ignored, 'executable' parameter is set to " + executable); } else { fork = true; // TODO somehow shaky dependency between compilerId and tool executable. - executable = tc.findTool(compilerId); + executable = tc.get().findTool(compilerId); } } // ---------------------------------------------------------------------- // // ---------------------------------------------------------------------- - List compileSourceRoots = removeEmptyCompileSourceRoots(getCompileSourceRoots()); + List compileSourceRoots = removeEmptyCompileSourceRoots(getCompileSourceRoots()); if (compileSourceRoots.isEmpty()) { getLog().info("No sources to compile"); - return; } // Verify that target or release is set if (!targetOrReleaseSet) { - MessageBuilder mb = MessageUtils.buffer() + MessageBuilder mb = messageBuilderFactory + .builder() .a("No explicit value set for target or release! ") .a("To ensure the same result even after upgrading this plugin, please add ") .newline() @@ -755,7 +633,7 @@ public void execute() throws MojoExecutionException, CompilationFailureException writePlugin(mb); - getLog().warn(mb.toString()); + getLog().warn(mb.build()); } // ---------------------------------------------------------------------- @@ -764,7 +642,8 @@ public void execute() throws MojoExecutionException, CompilationFailureException CompilerConfiguration compilerConfiguration = new CompilerConfiguration(); - compilerConfiguration.setOutputLocation(getOutputDirectory().getAbsolutePath()); + compilerConfiguration.setOutputLocation( + getOutputDirectory().toAbsolutePath().toString()); compilerConfiguration.setOptimize(optimize); @@ -774,7 +653,7 @@ public void execute() throws MojoExecutionException, CompilationFailureException compilerConfiguration.setImplicitOption(implicit); - if (debug && (debuglevel != null && !debuglevel.isEmpty())) { + if (debug && StringUtils.isNotEmpty(debuglevel)) { String[] split = StringUtils.split(debuglevel, ","); for (String aSplit : split) { if (!(aSplit.equalsIgnoreCase("none") @@ -798,11 +677,6 @@ public void execute() throws MojoExecutionException, CompilationFailureException compilerConfiguration.setFailOnWarning(failOnWarning); - if (failOnWarning && !showWarnings) { - getLog().warn("The property failOnWarning is set to true, but showWarnings is set to false."); - getLog().warn("With compiler's warnings silenced the failOnWarning has no effect."); - } - compilerConfiguration.setShowDeprecation(showDeprecation); compilerConfiguration.setSourceVersion(getSource()); @@ -813,39 +687,40 @@ public void execute() throws MojoExecutionException, CompilationFailureException compilerConfiguration.setProc(proc); - File generatedSourcesDirectory = getGeneratedSourcesDirectory(); + Path generatedSourcesDirectory = getGeneratedSourcesDirectory(); compilerConfiguration.setGeneratedSourcesDirectory( - generatedSourcesDirectory != null ? generatedSourcesDirectory.getAbsoluteFile() : null); + generatedSourcesDirectory != null + ? generatedSourcesDirectory.toFile().getAbsoluteFile() + : null); if (generatedSourcesDirectory != null) { - if (!generatedSourcesDirectory.exists()) { - generatedSourcesDirectory.mkdirs(); + if (!Files.exists(generatedSourcesDirectory)) { + try { + Files.createDirectories(generatedSourcesDirectory); + } catch (IOException e) { + throw new MojoException("Unable to create directory: " + generatedSourcesDirectory, e); + } } - String generatedSourcesPath = generatedSourcesDirectory.getAbsolutePath(); + Path generatedSourcesPath = generatedSourcesDirectory.toAbsolutePath(); compileSourceRoots.add(generatedSourcesPath); - if (isTestCompile()) { - getLog().debug("Adding " + generatedSourcesPath + " to test-compile source roots:\n " - + StringUtils.join(project.getTestCompileSourceRoots().iterator(), "\n ")); - - project.addTestCompileSourceRoot(generatedSourcesPath); + ProjectScope scope = isTestCompile() ? ProjectScope.TEST : ProjectScope.MAIN; - getLog().debug("New test-compile source roots:\n " - + StringUtils.join(project.getTestCompileSourceRoots().iterator(), "\n ")); - } else { - getLog().debug("Adding " + generatedSourcesPath + " to compile source roots:\n " - + StringUtils.join(project.getCompileSourceRoots().iterator(), "\n ")); + getLog().debug("Adding " + generatedSourcesPath + " to " + scope.id() + "-compile source roots:\n " + + StringUtils.join( + projectManager.getCompileSourceRoots(project, scope).iterator(), "\n ")); - project.addCompileSourceRoot(generatedSourcesPath); + projectManager.addCompileSourceRoot(project, scope, generatedSourcesPath); - getLog().debug("New compile source roots:\n " - + StringUtils.join(project.getCompileSourceRoots().iterator(), "\n ")); - } + getLog().debug("New " + scope.id() + "-compile source roots:\n " + + StringUtils.join( + projectManager.getCompileSourceRoots(project, scope).iterator(), "\n ")); } - compilerConfiguration.setSourceLocations(compileSourceRoots); + compilerConfiguration.setSourceLocations( + compileSourceRoots.stream().map(Path::toString).collect(Collectors.toList())); compilerConfiguration.setAnnotationProcessors(annotationProcessors); @@ -856,7 +731,7 @@ public void execute() throws MojoExecutionException, CompilationFailureException compilerConfiguration.setFork(fork); if (fork) { - if (!(meminitial == null || meminitial.isEmpty())) { + if (!StringUtils.isEmpty(meminitial)) { String value = getMemoryValue(meminitial); if (value != null) { @@ -866,7 +741,7 @@ public void execute() throws MojoExecutionException, CompilationFailureException } } - if (!(maxmem == null || maxmem.isEmpty())) { + if (!StringUtils.isEmpty(maxmem)) { String value = getMemoryValue(maxmem); if (value != null) { @@ -879,11 +754,11 @@ public void execute() throws MojoExecutionException, CompilationFailureException compilerConfiguration.setExecutable(executable); - compilerConfiguration.setWorkingDirectory(basedir); + compilerConfiguration.setWorkingDirectory(basedir.toFile()); compilerConfiguration.setCompilerVersion(compilerVersion); - compilerConfiguration.setBuildDirectory(buildDirectory); + compilerConfiguration.setBuildDirectory(buildDirectory.toFile()); compilerConfiguration.setOutputFileName(outputFileName); @@ -911,15 +786,13 @@ public void execute() throws MojoExecutionException, CompilationFailureException getLog().debug("CompilerReuseStrategy: " + compilerConfiguration.getCompilerReuseStrategy().getStrategy()); - compilerConfiguration.setForceJavacCompilerUse(forceLegacyJavacApi || forceJavacCompilerUse); + compilerConfiguration.setForceJavacCompilerUse(forceJavacCompilerUse); boolean canUpdateTarget; - IncrementalBuildHelper incrementalBuildHelper = new IncrementalBuildHelper(mojoExecution, session); - - final Set sources; + IncrementalBuildHelper incrementalBuildHelper = null; - IncrementalBuildHelperRequest incrementalBuildHelperRequest = null; + final Set sources; if (useIncrementalCompilation) { getLog().debug("useIncrementalCompilation enabled"); @@ -930,36 +803,45 @@ public void execute() throws MojoExecutionException, CompilationFailureException preparePaths(sources); - incrementalBuildHelperRequest = new IncrementalBuildHelperRequest().inputFiles(sources); - - // Strategies used to detect modifications. - String immutableOutputFile = (compiler.getCompilerOutputStyle() - .equals(CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES) - && !canUpdateTarget) - ? "immutable single output file" - : null; - String dependencyChanged = isDependencyChanged() ? "changed dependency" : null; - String sourceChanged = isSourceChanged(compilerConfiguration, compiler) ? "changed source code" : null; - String inputFileTreeChanged = hasInputFileTreeChanged(incrementalBuildHelper, sources) - ? "added or removed source files" - : null; - - // Get the first cause for the rebuild compilation detection. - String cause = Stream.of(immutableOutputFile, dependencyChanged, sourceChanged, inputFileTreeChanged) - .filter(Objects::nonNull) - .findFirst() - .orElse(null); - - if (cause != null) { - getLog().info("Recompiling the module because of " - + MessageUtils.buffer().strong(cause) + "."); - compilerConfiguration.setSourceFiles(sources); + incrementalBuildHelper = + new IncrementalBuildHelper(mojoStatusPath, sources, buildDirectory, getOutputDirectory()); + + List added = new ArrayList<>(); + List removed = new ArrayList<>(); + boolean immutableOutputFile = compiler.getCompilerOutputStyle() + .equals(CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES) + && !canUpdateTarget; + boolean dependencyChanged = isDependencyChanged(); + boolean sourceChanged = isSourceChanged(compilerConfiguration, compiler); + boolean inputFileTreeChanged = incrementalBuildHelper.inputFileTreeChanged(added, removed); + // CHECKSTYLE_OFF: LineLength + if (immutableOutputFile || dependencyChanged || sourceChanged || inputFileTreeChanged) + // CHECKSTYLE_ON: LineLength + { + String cause = immutableOutputFile + ? "immutable single output file" + : (dependencyChanged + ? "changed dependency" + : (sourceChanged ? "changed source code" : "added or removed source files")); + getLog().info("Recompiling the module because of " + cause + "."); + if (showCompilationChanges) { + for (String fileAdded : added) { + getLog().info("\t+ " + fileAdded); + } + for (String fileRemoved : removed) { + getLog().info("\t- " + fileRemoved); + } + } + + compilerConfiguration.setSourceFiles( + sources.stream().map(Path::toFile).collect(Collectors.toSet())); } else { - getLog().info("Nothing to compile - all classes are up to date."); + getLog().info("Nothing to compile - all classes are up to date"); + return; } } catch (CompilerException e) { - throw new MojoExecutionException("Error while computing stale sources.", e); + throw new MojoException("Error while computing stale sources.", e); } } else { getLog().debug("useIncrementalCompilation disabled"); @@ -982,11 +864,12 @@ public void execute() throws MojoExecutionException, CompilationFailureException } } catch (CompilerException e) { - throw new MojoExecutionException("Error while computing stale sources.", e); + throw new MojoException("Error while computing stale sources.", e); } if (staleSources.isEmpty()) { - getLog().info("Nothing to compile - all classes are up to date."); + getLog().info("Nothing to compile - all classes are up to date"); + return; } @@ -998,14 +881,14 @@ public void execute() throws MojoExecutionException, CompilationFailureException if (getLog().isDebugEnabled()) { getLog().debug("#sources: " + sources.size()); - for (File file : sources) { - getLog().debug(file.getPath()); + for (Path file : sources) { + getLog().debug(file.toString()); } } preparePaths(sources); } catch (CompilerException e) { - throw new MojoExecutionException("Error while computing stale sources.", e); + throw new MojoException("Error while computing stale sources.", e); } } @@ -1018,27 +901,10 @@ public void execute() throws MojoExecutionException, CompilationFailureException compilerConfiguration.setExcludes(getExcludes()); - Map effectiveCompilerArguments = getCompilerArguments(); - String effectiveCompilerArgument = getCompilerArgument(); - if ((effectiveCompilerArguments != null) || (effectiveCompilerArgument != null) || (compilerArgs != null)) { - if (effectiveCompilerArguments != null) { - for (Map.Entry me : effectiveCompilerArguments.entrySet()) { - String key = me.getKey(); - String value = me.getValue(); - if (!key.startsWith("-")) { - key = "-" + key; - } - - if (key.startsWith("-A") && (value != null && !value.isEmpty())) { - compilerConfiguration.addCompilerCustomArgument(key + "=" + value, null); - } else { - compilerConfiguration.addCompilerCustomArgument(key, value); - } - } - } - if (!(effectiveCompilerArgument == null || effectiveCompilerArgument.isEmpty())) { + if ((effectiveCompilerArgument != null) || (compilerArgs != null)) { + if (!StringUtils.isEmpty(effectiveCompilerArgument)) { compilerConfiguration.addCompilerCustomArgument(effectiveCompilerArgument, null); } if (compilerArgs != null) { @@ -1067,14 +933,14 @@ public void execute() throws MojoExecutionException, CompilationFailureException getLog().debug("Source roots:"); - for (String root : getCompileSourceRoots()) { + for (Path root : getCompileSourceRoots()) { getLog().debug(" " + root); } try { if (fork) { if (compilerConfiguration.getExecutable() != null) { - getLog().debug("Executable: "); + getLog().debug("Excutable: "); getLog().debug(" " + compilerConfiguration.getExecutable()); } } @@ -1088,10 +954,10 @@ public void execute() throws MojoExecutionException, CompilationFailureException sb.append(cl[i]); } getLog().debug("Command line options:"); - getLog().debug(sb); + getLog().debug(sb.toString()); } } catch (CompilerException ce) { - getLog().debug(ce); + getLog().debug("Compilation error", ce); } } @@ -1129,18 +995,15 @@ public void execute() throws MojoExecutionException, CompilationFailureException patchModule.append('='); Set patchModules = new LinkedHashSet<>(); - Set sourceRoots = new HashSet<>(getCompileSourceRoots().size()); - for (String sourceRoot : getCompileSourceRoots()) { - sourceRoots.add(Paths.get(sourceRoot)); - } + Set sourceRoots = new HashSet<>(getCompileSourceRoots()); String[] files = values[1].split(PS); for (String file : files) { Path filePath = Paths.get(file); - if (getOutputDirectory().toPath().equals(filePath)) { + if (getOutputDirectory().equals(filePath)) { patchModules.add("_"); // this jar - } else if (getOutputDirectory().toPath().startsWith(filePath)) { + } else if (getOutputDirectory().startsWith(filePath)) { // multirelease, can be ignored continue; } else if (sourceRoots.contains(filePath)) { @@ -1178,7 +1041,7 @@ public void execute() throws MojoExecutionException, CompilationFailureException } if (!jpmsLines.isEmpty()) { - Path jpmsArgs = Paths.get(getOutputDirectory().getAbsolutePath(), "META-INF/jpms.args"); + Path jpmsArgs = getOutputDirectory().toAbsolutePath().resolve("META-INF/jpms.args"); try { Files.createDirectories(jpmsArgs.getParent()); @@ -1193,31 +1056,14 @@ public void execute() throws MojoExecutionException, CompilationFailureException // ---------------------------------------------------------------------- if (StringUtils.isEmpty(compilerConfiguration.getSourceEncoding())) { - getLog().warn("File encoding has not been set, using platform encoding " - + MessageUtils.buffer().strong(Charset.defaultCharset()) + getLog().warn("File encoding has not been set, using platform encoding " + ReaderFactory.FILE_ENCODING + ", i.e. build is platform dependent!"); } CompilerResult compilerResult; if (useIncrementalCompilation) { - incrementalBuildHelperRequest.outputDirectory(getOutputDirectory()); - - // MCOMPILER-333: Cleanup the generated source files created by annotation processing - // to avoid issues with `javac` compiler when the source code is rebuild. - if (getGeneratedSourcesDirectory() != null) { - try (Stream walk = - Files.walk(getGeneratedSourcesDirectory().toPath())) { - walk.sorted(Comparator.reverseOrder()).map(Path::toFile).forEach(File::delete); - // MCOMPILER-567: The directory must already exist because javac does not create it. - Files.createDirectories(getGeneratedSourcesDirectory().toPath()); - } catch (IOException ex) { - getLog().warn("I/O error deleting the annotation processing generated files: " + ex.getMessage()); - } - } - - incrementalBuildHelper.beforeRebuildExecution(incrementalBuildHelperRequest); - + incrementalBuildHelper.beforeRebuildExecution(); getLog().debug("incrementalBuildHelper#beforeRebuildExecution"); } @@ -1225,7 +1071,7 @@ public void execute() throws MojoExecutionException, CompilationFailureException compilerResult = compiler.performCompile(compilerConfiguration); } catch (Exception e) { // TODO: don't catch Exception - throw new MojoExecutionException("Fatal error compiling", e); + throw new MojoException("Fatal error compiling", e); } if (createMissingPackageInfoClass @@ -1245,10 +1091,10 @@ public void execute() throws MojoExecutionException, CompilationFailureException } if (useIncrementalCompilation) { - if (incrementalBuildHelperRequest.getOutputDirectory().exists()) { + if (Files.exists(getOutputDirectory())) { getLog().debug("incrementalBuildHelper#afterRebuildExecution"); // now scan the same directory again and create a diff - incrementalBuildHelper.afterRebuildExecution(incrementalBuildHelperRequest); + incrementalBuildHelper.afterRebuildExecution(); } else { getLog().debug( "skip incrementalBuildHelper#afterRebuildExecution as the output directory doesn't exist"); @@ -1259,17 +1105,13 @@ public void execute() throws MojoExecutionException, CompilationFailureException List errors = new ArrayList<>(); List others = new ArrayList<>(); for (CompilerMessage message : compilerResult.getCompilerMessages()) { - switch (message.getKind()) { - case ERROR: - errors.add(message); - break; - case WARNING: - case MANDATORY_WARNING: - warnings.add(message); - break; - default: - others.add(message); - break; + if (message.getKind() == CompilerMessage.Kind.ERROR) { + errors.add(message); + } else if (message.getKind() == CompilerMessage.Kind.WARNING + || message.getKind() == CompilerMessage.Kind.MANDATORY_WARNING) { + warnings.add(message); + } else { + others.add(message); } } @@ -1314,9 +1156,11 @@ public void execute() throws MojoExecutionException, CompilationFailureException case OTHER: getLog().info(message.toString()); break; + case ERROR: getLog().error(message.toString()); break; + case MANDATORY_WARNING: case WARNING: default: @@ -1328,16 +1172,17 @@ public void execute() throws MojoExecutionException, CompilationFailureException } private void createMissingPackageInfoClasses( - CompilerConfiguration compilerConfiguration, SourceMapping sourceMapping, Set sources) + CompilerConfiguration compilerConfiguration, SourceMapping sourceMapping, Set sources) throws InclusionScanException, IOException { - for (File source : sources) { + for (Path source : sources) { String path = source.toString(); if (path.endsWith(File.separator + "package-info.java")) { - for (String root : getCompileSourceRoots()) { - root = root + File.separator; + for (Path rootPath : getCompileSourceRoots()) { + String root = rootPath.toString() + File.separator; if (path.startsWith(root)) { String rel = path.substring(root.length()); - Set files = sourceMapping.getTargetFiles(getOutputDirectory(), rel); + Set files = sourceMapping.getTargetFiles( + getOutputDirectory().toFile(), rel); for (File file : files) { if (!file.exists()) { File parentFile = file.getParentFile(); @@ -1396,13 +1241,36 @@ protected boolean isTestCompile() { return false; } + protected CompilerResult convertToCompilerResult(List compilerErrors) { + if (compilerErrors == null) { + return new CompilerResult(); + } + List messages = new ArrayList<>(compilerErrors.size()); + boolean success = true; + for (CompilerMessage compilerError : compilerErrors) { + messages.add(new CompilerMessage( + compilerError.getFile(), + compilerError.getKind(), + compilerError.getStartLine(), + compilerError.getStartColumn(), + compilerError.getEndLine(), + compilerError.getEndColumn(), + compilerError.getMessage())); + if (compilerError.isError()) { + success = false; + } + } + + return new CompilerResult(success, messages); + } + /** * @return all source files for the compiler */ - private Set getCompileSources(Compiler compiler, CompilerConfiguration compilerConfiguration) - throws MojoExecutionException, CompilerException { + private Set getCompileSources(Compiler compiler, CompilerConfiguration compilerConfiguration) + throws MojoException, CompilerException { String inputFileEnding = compiler.getInputFileEnding(compilerConfiguration); - if (inputFileEnding == null || inputFileEnding.isEmpty()) { + if (StringUtils.isEmpty(inputFileEnding)) { // see MCOMPILER-199 GroovyEclipseCompiler doesn't set inputFileEnding // so we can presume it's all files from the source directory inputFileEnding = ".*"; @@ -1413,20 +1281,18 @@ private Set getCompileSources(Compiler compiler, CompilerConfiguration com scanner.addSourceMapping(mapping); - Set compileSources = new HashSet<>(); - - for (String sourceRoot : getCompileSourceRoots()) { - File rootFile = new File(sourceRoot); + Set compileSources = new HashSet<>(); - if (!rootFile.isDirectory() - || rootFile.getAbsoluteFile().equals(compilerConfiguration.getGeneratedSourcesDirectory())) { + for (Path sourceRoot : getCompileSourceRoots()) { + if (!Files.isDirectory(sourceRoot) + || sourceRoot.toFile().equals(compilerConfiguration.getGeneratedSourcesDirectory())) { continue; } try { - compileSources.addAll(scanner.getIncludedSources(rootFile, null)); + scanner.getIncludedSources(sourceRoot.toFile(), null).forEach(f -> compileSources.add(f.toPath())); } catch (InclusionScanException e) { - throw new MojoExecutionException( + throw new MojoException( "Error scanning source root: '" + sourceRoot + "' for stale files to recompile.", e); } } @@ -1441,21 +1307,20 @@ private Set getCompileSources(Compiler compiler, CompilerConfiguration com /** * @param compilerConfiguration * @param compiler - * @return {@code true} if at least a single source file is newer than it's class file + * @return true if at least a single source file is newer than it's class file */ - private boolean isSourceChanged(CompilerConfiguration compilerConfiguration, Compiler compiler) { - Set staleSources = Collections.emptySet(); - try { - staleSources = computeStaleSources(compilerConfiguration, compiler, getSourceInclusionScanner(staleMillis)); - } catch (MojoExecutionException | CompilerException ex) { - // we cannot detect Stale Sources, so don't do anything beside logging - getLog().warn("Cannot detect stale sources."); - return false; - } + private boolean isSourceChanged(CompilerConfiguration compilerConfiguration, Compiler compiler) + throws CompilerException, MojoException { + Set staleSources = + computeStaleSources(compilerConfiguration, compiler, getSourceInclusionScanner(staleMillis)); if (getLog().isDebugEnabled() || showCompilationChanges) { for (File f : staleSources) { - getLog().info("\tStale source detected: " + f.getAbsolutePath()); + if (showCompilationChanges) { + getLog().info("Stale source detected: " + f.getAbsolutePath()); + } else { + getLog().debug("Stale source detected: " + f.getAbsolutePath()); + } } } return !staleSources.isEmpty(); @@ -1467,18 +1332,11 @@ private boolean isSourceChanged(CompilerConfiguration compilerConfiguration, Com * @return number of thread for this build or 1 if not multi-thread build */ protected int getRequestThreadCount() { - return session.getRequest().getDegreeOfConcurrency(); + return session.getDegreeOfConcurrency(); } - protected Date getBuildStartTime() { - return getBuildStartTimeInstant().map(Date::from).orElseGet(Date::new); - } - - private Optional getBuildStartTimeInstant() { - return Optional.ofNullable(session.getRequest()) - .map(MavenExecutionRequest::getStartTime) - .map(Date::toInstant) - .map(i -> i.truncatedTo(ChronoUnit.MILLIS)); + protected Instant getBuildStartTime() { + return session.getStartTime(); } private String getMemoryValue(String setting) { @@ -1494,21 +1352,14 @@ private String getMemoryValue(String setting) { return value; } - protected final Toolchain getToolchain() { - Toolchain tc = null; - + protected final Optional getToolchain() { if (jdkToolchain != null) { List tcs = toolchainManager.getToolchains(session, "jdk", jdkToolchain); if (tcs != null && !tcs.isEmpty()) { - tc = tcs.get(0); + return Optional.of(tcs.get(0)); } } - - if (tc == null) { - tc = toolchainManager.getToolchainFromBuildContext("jdk", session); - } - - return tc; + return toolchainManager.getToolchainFromBuildContext(session, "jdk"); } private boolean isDigits(String string) { @@ -1522,10 +1373,10 @@ private boolean isDigits(String string) { private Set computeStaleSources( CompilerConfiguration compilerConfiguration, Compiler compiler, SourceInclusionScanner scanner) - throws MojoExecutionException, CompilerException { + throws MojoException, CompilerException { SourceMapping mapping = getSourceMapping(compilerConfiguration, compiler); - File outputDirectory; + Path outputDirectory; CompilerOutputStyle outputStyle = compiler.getCompilerOutputStyle(); if (outputStyle == CompilerOutputStyle.ONE_OUTPUT_FILE_FOR_ALL_INPUT_FILES) { outputDirectory = buildDirectory; @@ -1537,17 +1388,15 @@ private Set computeStaleSources( Set staleSources = new HashSet<>(); - for (String sourceRoot : getCompileSourceRoots()) { - File rootFile = new File(sourceRoot); - - if (!rootFile.isDirectory()) { + for (Path sourceRoot : getCompileSourceRoots()) { + if (!Files.isDirectory(sourceRoot)) { continue; } try { - staleSources.addAll(scanner.getIncludedSources(rootFile, outputDirectory)); + staleSources.addAll(scanner.getIncludedSources(sourceRoot.toFile(), outputDirectory.toFile())); } catch (InclusionScanException e) { - throw new MojoExecutionException( + throw new MojoException( "Error scanning source root: \'" + sourceRoot + "\' for stale files to recompile.", e); } } @@ -1556,7 +1405,7 @@ private Set computeStaleSources( } private SourceMapping getSourceMapping(CompilerConfiguration compilerConfiguration, Compiler compiler) - throws CompilerException, MojoExecutionException { + throws CompilerException, MojoException { CompilerOutputStyle outputStyle = compiler.getCompilerOutputStyle(); SourceMapping mapping; @@ -1569,7 +1418,7 @@ private SourceMapping getSourceMapping(CompilerConfiguration compilerConfigurati compiler.getInputFileEnding(compilerConfiguration), compiler.getOutputFile(compilerConfiguration)); } else { - throw new MojoExecutionException("Unknown compiler output style: '" + outputStyle + "'."); + throw new MojoException("Unknown compiler output style: '" + outputStyle + "'."); } return mapping; } @@ -1578,17 +1427,12 @@ private SourceMapping getSourceMapping(CompilerConfiguration compilerConfigurati * @todo also in ant plugin. This should be resolved at some point so that it does not need to * be calculated continuously - or should the plugins accept empty source roots as is? */ - private static List removeEmptyCompileSourceRoots(List compileSourceRootsList) { - List newCompileSourceRootsList = new ArrayList<>(); + private static List removeEmptyCompileSourceRoots(List compileSourceRootsList) { if (compileSourceRootsList != null) { - // copy as I may be modifying it - for (String srcDir : compileSourceRootsList) { - if (!newCompileSourceRootsList.contains(srcDir) && new File(srcDir).exists()) { - newCompileSourceRootsList.add(srcDir); - } - } + return compileSourceRootsList.stream().filter(Files::exists).collect(Collectors.toList()); + } else { + return new ArrayList<>(); } - return newCompileSourceRootsList; } /** @@ -1596,41 +1440,36 @@ private static List removeEmptyCompileSourceRoots(List compileSo * generated classes and if we got a file which is >= the build-started timestamp, then we caught a file which * got changed during this build. * - * @return {@code true} if at least one single dependency has changed. + * @return true if at least one single dependency has changed. */ protected boolean isDependencyChanged() { - final Instant buildStartTime = getBuildStartTimeInstant().orElse(null); - if (buildStartTime == null) { + if (session == null) { // we just cannot determine it, so don't do anything beside logging - getLog().debug("Cannot determine build start time, skipping incremental build detection."); + getLog().info("Cannot determine build start date, skipping incremental build detection."); return false; } if (fileExtensions == null || fileExtensions.isEmpty()) { - fileExtensions = new HashSet<>(Arrays.asList("class", "jar")); + fileExtensions = Collections.unmodifiableList(Arrays.asList("class", "jar")); } + Instant buildStartTime = getBuildStartTime(); + List pathElements = new ArrayList<>(); pathElements.addAll(getClasspathElements()); pathElements.addAll(getModulepathElements()); for (String pathElement : pathElements) { - Path artifactPath = Paths.get(pathElement); - - // Search files only on dependencies (other modules), not on the current project, - if (Files.isDirectory(artifactPath) - && !artifactPath.equals(getOutputDirectory().toPath())) { - try (Stream walk = Files.walk(artifactPath)) { - if (walk.anyMatch(p -> hasNewFile(p, buildStartTime))) { - return true; + File artifactPath = new File(pathElement); + if (artifactPath.isDirectory() || artifactPath.isFile()) { + if (hasNewFile(artifactPath, buildStartTime)) { + if (showCompilationChanges) { + getLog().info("New dependency detected: " + artifactPath.getAbsolutePath()); + } else { + getLog().debug("New dependency detected: " + artifactPath.getAbsolutePath()); } - } catch (IOException ex) { - // we just cannot determine it, so don't do anything beside logging - getLog().warn("I/O error walking the path: " + ex.getMessage()); - return false; + return true; } - } else if (hasNewFile(artifactPath, buildStartTime)) { - return true; } } @@ -1639,137 +1478,68 @@ protected boolean isDependencyChanged() { } /** - * @param file entry to check + * @param classPathEntry entry to check * @param buildStartTime time build start * @return if any changes occurred */ - private boolean hasNewFile(Path file, Instant buildStartTime) { - if (Files.isRegularFile(file) - && fileExtensions.contains( - FileUtils.extension(file.getFileName().toString()))) { - try { - Instant lastModifiedTime = Files.getLastModifiedTime(file) - .toInstant() - .minusMillis(staleMillis) - .truncatedTo(ChronoUnit.MILLIS); - boolean hasChanged = lastModifiedTime.isAfter(buildStartTime); - if (hasChanged && (getLog().isDebugEnabled() || showCompilationChanges)) { - getLog().info("\tNew dependency detected: " + file.toAbsolutePath()); - } - return hasChanged; - } catch (IOException ex) { - // we just cannot determine it, so don't do anything beside logging - getLog().warn("I/O error reading the lastModifiedTime: " + ex.getMessage()); + private boolean hasNewFile(File classPathEntry, Instant buildStartTime) { + // TODO: rewrite with NIO api + if (!classPathEntry.exists()) { + return false; + } + + if (classPathEntry.isFile()) { + return classPathEntry.lastModified() >= buildStartTime.toEpochMilli() + && fileExtensions.contains(FileUtils.getExtension(classPathEntry.getName())); + } + + File[] children = classPathEntry.listFiles(); + + for (File child : children) { + if (hasNewFile(child, buildStartTime)) { + return true; } } return false; } - private List resolveProcessorPathEntries() throws MojoExecutionException { + private List resolveProcessorPathEntries() throws MojoException { if (annotationProcessorPaths == null || annotationProcessorPaths.isEmpty()) { return null; } try { - List dependencies = convertToDependencies(annotationProcessorPaths); - List managedDependencies = - getManagedDependenciesForAnnotationProcessorPaths(); - CollectRequest collectRequest = - new CollectRequest(dependencies, managedDependencies, project.getRemoteProjectRepositories()); - DependencyRequest dependencyRequest = new DependencyRequest(); - dependencyRequest.setCollectRequest(collectRequest); - DependencyResult dependencyResult = - repositorySystem.resolveDependencies(session.getRepositorySession(), dependencyRequest); - - return dependencyResult.getArtifactResults().stream() - .map(resolved -> resolved.getArtifact().getFile().getAbsolutePath()) + Session session = this.session.withRemoteRepositories(projectManager.getRemoteProjectRepositories(project)); + List coords = + annotationProcessorPaths.stream().map(this::toCoordinate).collect(Collectors.toList()); + return session + .getService(DependencyResolver.class) + .resolve(DependencyResolverRequest.builder() + .session(session) + .dependencies(coords) + .managedDependencies(project.getManagedDependencies()) + .pathScope(PathScope.MAIN_RUNTIME) + .build()) + .getPaths() + .stream() + .map(Path::toString) .collect(Collectors.toList()); } catch (Exception e) { - throw new MojoExecutionException( - "Resolution of annotationProcessorPath dependencies failed: " + e.getLocalizedMessage(), e); - } - } - - private List convertToDependencies( - List annotationProcessorPaths) throws MojoExecutionException { - List dependencies = new ArrayList<>(); - for (DependencyCoordinate annotationProcessorPath : annotationProcessorPaths) { - ArtifactHandler handler = artifactHandlerManager.getArtifactHandler(annotationProcessorPath.getType()); - String version = getAnnotationProcessorPathVersion(annotationProcessorPath); - Artifact artifact = new DefaultArtifact( - annotationProcessorPath.getGroupId(), - annotationProcessorPath.getArtifactId(), - annotationProcessorPath.getClassifier(), - handler.getExtension(), - version); - Set exclusions = convertToAetherExclusions(annotationProcessorPath.getExclusions()); - dependencies.add(new org.eclipse.aether.graph.Dependency(artifact, JavaScopes.RUNTIME, false, exclusions)); - } - return dependencies; - } - - private String getAnnotationProcessorPathVersion(DependencyCoordinate annotationProcessorPath) - throws MojoExecutionException { - String configuredVersion = annotationProcessorPath.getVersion(); - if (configuredVersion != null) { - return configuredVersion; - } else { - List managedDependencies = getProjectManagedDependencies(); - return findManagedVersion(annotationProcessorPath, managedDependencies) - .orElseThrow(() -> new MojoExecutionException(String.format( - "Cannot find version for annotation processor path '%s'. The version needs to be either" - + " provided directly in the plugin configuration or via dependency management.", - annotationProcessorPath))); - } - } - - private Optional findManagedVersion( - DependencyCoordinate dependencyCoordinate, List managedDependencies) { - return managedDependencies.stream() - .filter(dep -> Objects.equals(dep.getGroupId(), dependencyCoordinate.getGroupId()) - && Objects.equals(dep.getArtifactId(), dependencyCoordinate.getArtifactId()) - && Objects.equals(dep.getClassifier(), dependencyCoordinate.getClassifier()) - && Objects.equals(dep.getType(), dependencyCoordinate.getType())) - .findAny() - .map(org.apache.maven.model.Dependency::getVersion); - } - - private List getManagedDependenciesForAnnotationProcessorPaths() { - if (!annotationProcessorPathsUseDepMgmt) { - return Collections.emptyList(); + throw new MojoException("Resolution of annotationProcessorPath dependencies failed: " + e.getMessage(), e); } - List projectManagedDependencies = getProjectManagedDependencies(); - ArtifactTypeRegistry artifactTypeRegistry = - session.getRepositorySession().getArtifactTypeRegistry(); - - return projectManagedDependencies.stream() - .map(dep -> RepositoryUtils.toDependency(dep, artifactTypeRegistry)) - .collect(Collectors.toList()); } - private List getProjectManagedDependencies() { - DependencyManagement dependencyManagement = project.getDependencyManagement(); - if (dependencyManagement == null || dependencyManagement.getDependencies() == null) { - return Collections.emptyList(); - } - return dependencyManagement.getDependencies(); - } - - private Set convertToAetherExclusions(Set exclusions) { - if (exclusions == null || exclusions.isEmpty()) { - return Collections.emptySet(); - } - Set aetherExclusions = new HashSet<>(); - for (DependencyExclusion exclusion : exclusions) { - Exclusion aetherExclusion = new Exclusion( - exclusion.getGroupId(), - exclusion.getArtifactId(), - exclusion.getClassifier(), - exclusion.getExtension()); - aetherExclusions.add(aetherExclusion); - } - return aetherExclusions; + private org.apache.maven.api.DependencyCoordinate toCoordinate(DependencyCoordinate coord) { + return session.getService(DependencyCoordinateFactory.class) + .create(DependencyCoordinateFactoryRequest.builder() + .session(session) + .groupId(coord.getGroupId()) + .artifactId(coord.getArtifactId()) + .classifier(coord.getClassifier()) + .type(coord.getType()) + .version(coord.getVersion()) + .build()); } private void writePlugin(MessageBuilder mb) { @@ -1817,52 +1587,6 @@ private String getMavenCompilerPluginVersion() { return pomProperties.getProperty("version"); } - private boolean hasInputFileTreeChanged(IncrementalBuildHelper ibh, Set inputFiles) { - Path mojoConfigBase; - try { - mojoConfigBase = ibh.getMojoStatusDirectory().toPath(); - } catch (MojoExecutionException e) { - // we cannot get the mojo status dir, so don't do anything beside logging - getLog().warn("Error reading mojo status directory."); - return false; - } - Path mojoConfigFile = mojoConfigBase.resolve(INPUT_FILES_LST_FILENAME); - - List oldInputFiles = Collections.emptyList(); - if (Files.isRegularFile(mojoConfigFile)) { - try { - oldInputFiles = Files.readAllLines(mojoConfigFile); - } catch (IOException e) { - // we cannot read the mojo config file, so don't do anything beside logging - getLog().warn("Error while reading old mojo status: " + mojoConfigFile); - return false; - } - } - - List newInputFiles = - inputFiles.stream().sorted().map(File::getAbsolutePath).collect(Collectors.toList()); - - try { - Files.write(mojoConfigFile, newInputFiles); - } catch (IOException e) { - // we cannot write the mojo config file, so don't do anything beside logging - getLog().warn("Error while writing new mojo status: " + mojoConfigFile); - return false; - } - - DeltaList inputTreeChanges = new DeltaList<>(oldInputFiles, newInputFiles); - if (getLog().isDebugEnabled() || showCompilationChanges) { - for (String fileAdded : inputTreeChanges.getAdded()) { - getLog().info("\tInput tree files (+): " + fileAdded); - } - for (String fileRemoved : inputTreeChanges.getRemoved()) { - getLog().info("\tInput tree files (-): " + fileRemoved); - } - } - - return inputTreeChanges.hasChanged(); - } - public void setTarget(String target) { this.target = target; targetOrReleaseSet = true; @@ -1886,9 +1610,9 @@ final String getImplicit() { * @see MCOMPILER-542 * @see JDK-8318913 */ - private void patchJdkModuleVersion(CompilerResult compilerResult, Set sources) throws MojoExecutionException { + private void patchJdkModuleVersion(CompilerResult compilerResult, Set sources) throws MojoException { if (compilerResult.isSuccess() && getModuleDeclaration(sources).isPresent()) { - Path moduleDescriptor = getOutputDirectory().toPath().resolve("module-info.class"); + Path moduleDescriptor = getOutputDirectory().resolve("module-info.class"); if (Files.isRegularFile(moduleDescriptor)) { try { final byte[] descriptorOriginal = Files.readAllBytes(moduleDescriptor); @@ -1898,9 +1622,83 @@ private void patchJdkModuleVersion(CompilerResult compilerResult, Set sour Files.write(moduleDescriptor, descriptorMod); } } catch (IOException ex) { - throw new MojoExecutionException("Error reading or writing module-info.class", ex); + throw new MojoException("Error reading or writing module-info.class", ex); } } } } + + protected final Optional getModuleDeclaration(final Set sourceFiles) { + for (Path sourceFile : sourceFiles) { + if ("module-info.java".equals(sourceFile.getFileName().toString())) { + return Optional.of(sourceFile); + } + } + return Optional.empty(); + } + + protected Log getLog() { + return logger; + } + + class MavenLogger extends AbstractLogger { + MavenLogger() { + super(0, AbstractCompilerMojo.this.getClass().getName()); + } + + @Override + public void debug(String message, Throwable throwable) { + logger.debug(message, throwable); + } + + @Override + public boolean isDebugEnabled() { + return logger.isDebugEnabled(); + } + + @Override + public void info(String message, Throwable throwable) { + logger.info(message, throwable); + } + + @Override + public boolean isInfoEnabled() { + return logger.isInfoEnabled(); + } + + @Override + public void warn(String message, Throwable throwable) { + logger.warn(message, throwable); + } + + @Override + public boolean isWarnEnabled() { + return logger.isWarnEnabled(); + } + + @Override + public void error(String message, Throwable throwable) { + logger.error(message, throwable); + } + + @Override + public boolean isErrorEnabled() { + return logger.isErrorEnabled(); + } + + @Override + public void fatalError(String message, Throwable throwable) { + logger.error(message, throwable); + } + + @Override + public boolean isFatalErrorEnabled() { + return isFatalErrorEnabled(); + } + + @Override + public Logger getChildLogger(String name) { + return this; + } + } } diff --git a/src/main/java/org/apache/maven/plugin/compiler/CompilationFailureException.java b/src/main/java/org/apache/maven/plugin/compiler/CompilationFailureException.java index fa55b16e..9efc5d8c 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/CompilationFailureException.java +++ b/src/main/java/org/apache/maven/plugin/compiler/CompilationFailureException.java @@ -20,7 +20,7 @@ import java.util.List; -import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.api.plugin.MojoException; import org.codehaus.plexus.compiler.CompilerMessage; /** @@ -28,7 +28,7 @@ * @since 2.0 */ @SuppressWarnings("serial") -public class CompilationFailureException extends MojoFailureException { +public class CompilationFailureException extends MojoException { private static final String LS = System.getProperty("line.separator"); /** 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 52da7ca8..36f9cd08 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java +++ b/src/main/java/org/apache/maven/plugin/compiler/CompilerMojo.java @@ -20,7 +20,9 @@ import java.io.File; import java.io.IOException; +import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -29,21 +31,17 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.Objects; import java.util.Optional; import java.util.Set; - -import org.apache.maven.artifact.Artifact; -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 org.apache.maven.project.MavenProject; -import org.apache.maven.shared.utils.StringUtils; -import org.apache.maven.shared.utils.logging.MessageUtils; -import org.apache.maven.toolchain.Toolchain; -import org.apache.maven.toolchain.java.DefaultJavaToolChain; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.apache.maven.api.*; +import org.apache.maven.api.plugin.MojoException; +import org.apache.maven.api.plugin.annotations.LifecyclePhase; +import org.apache.maven.api.plugin.annotations.Mojo; +import org.apache.maven.api.plugin.annotations.Parameter; +import org.apache.maven.api.services.MessageBuilderFactory; import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner; import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner; import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner; @@ -52,92 +50,72 @@ import org.codehaus.plexus.languages.java.jpms.ModuleNameSource; import org.codehaus.plexus.languages.java.jpms.ResolvePathsRequest; import org.codehaus.plexus.languages.java.jpms.ResolvePathsResult; +import org.codehaus.plexus.util.StringUtils; /** - * Compiles application sources. - * By default uses the javac compiler - * of the JDK used to execute Maven. This can be overwritten through Toolchains - * or parameter {@link AbstractCompilerMojo#compilerId}. + * Compiles application sources * * @author Jason van Zyl * @since 2.0 - * @see javac Command */ -@Mojo( - name = "compile", - defaultPhase = LifecyclePhase.COMPILE, - threadSafe = true, - requiresDependencyResolution = ResolutionScope.COMPILE) +@Mojo(name = "compile", defaultPhase = LifecyclePhase.COMPILE) public class CompilerMojo extends AbstractCompilerMojo { /** * The source directories containing the sources to be compiled. */ - @Parameter(defaultValue = "${project.compileSourceRoots}", readonly = false, required = true) - private List compileSourceRoots; + @Parameter + protected List compileSourceRoots; /** - * The directory for compiled classes. - *

- * This parameter should only be modified in special cases. One example is creating - * a multi-release jar with a lower bytecode level (i.e. setting it to - * {@code ${project.build.outputDirectory}/META-INF/versions/21} or similar) in an additional - * execution. - *

- * When the required bytecode level is available though an installed JDK or toolchain, - * it is recommended to use the {@code } property - * in conjunction with the ${multiReleaseOutput} parameter instead. + * Projects main artifact. */ - @Parameter( - property = "maven.compiler.outputDirectory", - defaultValue = "${project.build.outputDirectory}", - required = true, - readonly = false) - private File outputDirectory; + @Parameter(defaultValue = "${project.mainArtifact}", readonly = true, required = true) + protected Artifact projectArtifact; /** - * Projects main artifact. - * - * @todo this is an export variable, really + * The directory for compiled classes. */ - @Parameter(defaultValue = "${project.artifact}", readonly = true, required = true) - private Artifact projectArtifact; + @Parameter(defaultValue = "${project.build.outputDirectory}", required = true, readonly = true) + protected Path outputDirectory; /** * A list of inclusion filters for the compiler. */ @Parameter - private Set includes = new HashSet<>(); + protected Set includes = new HashSet<>(); /** * A list of exclusion filters for the compiler. */ @Parameter - private Set excludes = new HashSet<>(); + protected Set excludes = new HashSet<>(); /** * A list of exclusion filters for the incremental calculation. * @since 3.11 */ @Parameter - private Set incrementalExcludes = new HashSet<>(); + protected Set incrementalExcludes = new HashSet<>(); /** + *

* Specify where to place generated source files created by annotation processing. Only applies to JDK 1.6+ + *

* * @since 2.2 */ @Parameter(defaultValue = "${project.build.directory}/generated-sources/annotations") - private File generatedSourcesDirectory; + protected Path generatedSourcesDirectory; /** - * Set this to {@code true} to bypass compilation of main sources. Its use is NOT RECOMMENDED, but quite convenient on + * Set this to 'true' to bypass compilation of main sources. Its use is NOT RECOMMENDED, but quite convenient on * occasion. */ @Parameter(property = "maven.main.skip") - private boolean skipMain; + protected boolean skipMain; - @Parameter(defaultValue = "${project.compileClasspathElements}", readonly = true, required = true) - private List compilePath; + @Parameter + protected List compilePath; /** *

@@ -152,15 +130,14 @@ public class CompilerMojo extends AbstractCompilerMojo { * @since 3.7.1 */ @Parameter - private boolean multiReleaseOutput; + protected boolean multiReleaseOutput; /** - * When both {@link AbstractCompilerMojo#fork} and {@link AbstractCompilerMojo#debug} are enabled the commandline arguments used - * will be dumped to this file. + * when forking and debug activated the commandline used will be dumped in this file * @since 3.10.0 */ @Parameter(defaultValue = "javac") - private String debugFileName; + protected String debugFileName; final LocationManager locationManager = new LocationManager(); @@ -170,9 +147,12 @@ public class CompilerMojo extends AbstractCompilerMojo { private Map pathElements; - @Override - protected List getCompileSourceRoots() { - return compileSourceRoots; + protected List getCompileSourceRoots() { + if (compileSourceRoots == null || compileSourceRoots.isEmpty()) { + return projectManager.getCompileSourceRoots(getProject(), ProjectScope.MAIN); + } else { + return compileSourceRoots.stream().map(Paths::get).collect(Collectors.toList()); + } } @Override @@ -190,36 +170,30 @@ protected Map getPathElements() { return pathElements; } - @Override - protected File getOutputDirectory() { - File dir; + protected Path getOutputDirectory() { + Path dir; if (!multiReleaseOutput) { dir = outputDirectory; } else { - dir = new File(outputDirectory, "META-INF/versions/" + release); + dir = outputDirectory.resolve("META-INF/versions/" + release); } return dir; } - @Override - public void execute() throws MojoExecutionException, CompilationFailureException { + public void execute() throws MojoException { if (skipMain) { getLog().info("Not compiling main sources"); return; } if (multiReleaseOutput && release == null) { - throw new MojoExecutionException("When using 'multiReleaseOutput' the release must be set"); + throw new MojoException("When using 'multiReleaseOutput' the release must be set"); } super.execute(); - if (outputDirectory.isDirectory()) { - File artifactFile = projectArtifact.getFile(); - if (artifactFile != null && !Objects.equals(artifactFile, outputDirectory)) { - getLog().warn("Overwriting artifact's file from " + artifactFile + " to " + outputDirectory); - } - projectArtifact.setFile(outputDirectory); + if (Files.isDirectory(outputDirectory) && projectArtifact != null) { + artifactManager.setPath(projectArtifact, outputDirectory); } } @@ -234,12 +208,28 @@ protected Set getExcludes() { } @Override - protected void preparePaths(Set sourceFiles) { + protected void preparePaths(Set sourceFiles) { // assert compilePath != null; + List compilePath = this.compilePath; + if (compilePath == null) { + Stream s1 = Stream.of(getOutputDirectory().toString()); + Stream s2 = session.resolveDependencies(getProject(), PathScope.MAIN_COMPILE).stream() + .map(Path::toString); + compilePath = Stream.concat(s1, s2).collect(Collectors.toList()); + } - Optional moduleDeclaration = getModuleDeclaration(sourceFiles); + Path moduleDescriptorPath = null; - if (moduleDeclaration.isPresent()) { + boolean hasModuleDescriptor = false; + for (Path sourceFile : sourceFiles) { + if ("module-info.java".equals(sourceFile.getFileName().toString())) { + moduleDescriptorPath = sourceFile; + hasModuleDescriptor = true; + break; + } + } + + if (hasModuleDescriptor) { // For now only allow named modules. Once we can create a graph with ASM we can specify exactly the modules // and we can detect if auto modules are used. In that case, MavenProject.setFile() should not be used, so // you cannot depend on this project and so it won't be distributed. @@ -250,15 +240,17 @@ protected void preparePaths(Set sourceFiles) { ResolvePathsResult resolvePathsResult; try { - Collection dependencyArtifacts = getCompileClasspathElements(getProject()); + Collection dependencyArtifacts = getCompileClasspathElements(getProject()).stream() + .map(Path::toFile) + .collect(Collectors.toList()); ResolvePathsRequest request = ResolvePathsRequest.ofFiles(dependencyArtifacts) .setIncludeStatic(true) - .setMainModuleDescriptor(moduleDeclaration.get().toFile()); + .setMainModuleDescriptor(moduleDescriptorPath.toFile()); - Toolchain toolchain = getToolchain(); - if (toolchain instanceof DefaultJavaToolChain) { - request.setJdkHome(new File(((DefaultJavaToolChain) toolchain).getJavaHome())); + Optional toolchain = getToolchain(); + if (toolchain.isPresent() && toolchain.get() instanceof JavaToolchain) { + request.setJdkHome(new File(((JavaToolchain) toolchain.get()).getJavaHome())); } resolvePathsResult = locationManager.resolvePaths(request); @@ -290,7 +282,7 @@ protected void preparePaths(Set sourceFiles) { classpathElements.add(file.getPath()); if (multiReleaseOutput) { - if (getOutputDirectory().toPath().startsWith(file.getPath())) { + if (getOutputDirectory().startsWith(file.getPath())) { compilerArgs.add("--patch-module"); compilerArgs.add(String.format("%s=%s", moduleDescriptor.name(), file.getPath())); } @@ -309,11 +301,10 @@ protected void preparePaths(Set sourceFiles) { } } else { classpathElements = new ArrayList<>(); - for (File element : getCompileClasspathElements(getProject())) { - classpathElements.add(element.getPath()); + for (Path element : getCompileClasspathElements(getProject())) { + classpathElements.add(element.toString()); } modulepathElements = Collections.emptyList(); - pathElements = Collections.emptyMap(); } } @@ -342,33 +333,31 @@ private void detectFilenameBasedAutomodules( } } - private List getCompileClasspathElements(MavenProject project) { + private List getCompileClasspathElements(Project project) { + List artifacts = session.resolveDependencies(project, PathScope.MAIN_COMPILE); + // 3 is outputFolder + 2 preserved for multirelease - List list = new ArrayList<>(project.getArtifacts().size() + 3); + List list = new ArrayList<>(artifacts.size() + 3); if (multiReleaseOutput) { - File versionsFolder = new File(project.getBuild().getOutputDirectory(), "META-INF/versions"); + Path versionsFolder = outputDirectory.resolve("META-INF/versions"); // in reverse order for (int version = Integer.parseInt(getRelease()) - 1; version >= 9; version--) { - File versionSubFolder = new File(versionsFolder, String.valueOf(version)); - if (versionSubFolder.exists()) { + Path versionSubFolder = versionsFolder.resolve(String.valueOf(version)); + if (Files.exists(versionSubFolder)) { list.add(versionSubFolder); } } } - list.add(new File(project.getBuild().getOutputDirectory())); + list.add(outputDirectory); + + list.addAll(artifacts); - for (Artifact a : project.getArtifacts()) { - if (a.getArtifactHandler().isAddedToClasspath()) { - list.add(a.getFile()); - } - } return list; } - @Override protected SourceInclusionScanner getSourceInclusionScanner(int staleMillis) { if (includes.isEmpty() && excludes.isEmpty() && incrementalExcludes.isEmpty()) { return new StaleSourceScanner(staleMillis); @@ -383,7 +372,6 @@ protected SourceInclusionScanner getSourceInclusionScanner(int staleMillis) { return new StaleSourceScanner(staleMillis, includes, excludesIncr); } - @Override protected SourceInclusionScanner getSourceInclusionScanner(String inputFileEnding) { // it's not defined if we get the ending with or without the dot '.' String defaultIncludePattern = "**/*" + (inputFileEnding.startsWith(".") ? "" : ".") + inputFileEnding; @@ -396,12 +384,10 @@ protected SourceInclusionScanner getSourceInclusionScanner(String inputFileEndin return new SimpleSourceInclusionScanner(includes, excludesIncr); } - @Override protected String getSource() { return source; } - @Override protected String getTarget() { return target; } @@ -411,18 +397,11 @@ protected String getRelease() { return release; } - @Override protected String getCompilerArgument() { return compilerArgument; } - @Override - protected Map getCompilerArguments() { - return compilerArguments; - } - - @Override - protected File getGeneratedSourcesDirectory() { + protected Path getGeneratedSourcesDirectory() { return generatedSourcesDirectory; } @@ -434,7 +413,14 @@ protected String getDebugFileName() { private void writeBoxedWarning(String message) { String line = StringUtils.repeat("*", message.length() + 4); getLog().warn(line); - getLog().warn("* " + MessageUtils.buffer().strong(message) + " *"); + getLog().warn("* " + strong(message) + " *"); getLog().warn(line); } + + private String strong(String message) { + return session.getService(MessageBuilderFactory.class) + .builder() + .strong(message) + .build(); + } } diff --git a/src/main/java/org/apache/maven/plugin/compiler/DeltaList.java b/src/main/java/org/apache/maven/plugin/compiler/DeltaList.java deleted file mode 100644 index 18943fab..00000000 --- a/src/main/java/org/apache/maven/plugin/compiler/DeltaList.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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. - */ -package org.apache.maven.plugin.compiler; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -/** - * Show the modifications between two lists. - */ -final class DeltaList { - - private final List added; - private final List removed; - private final boolean hasChanged; - - DeltaList(Collection oldList, Collection newList) { - this.added = new ArrayList<>(newList); - this.removed = new ArrayList<>(oldList); - added.removeAll(oldList); - removed.removeAll(newList); - this.hasChanged = !added.isEmpty() || !removed.isEmpty(); - } - - Collection getAdded() { - return Collections.unmodifiableCollection(added); - } - - Collection getRemoved() { - return Collections.unmodifiableCollection(removed); - } - - boolean hasChanged() { - return hasChanged; - } -} diff --git a/src/main/java/org/apache/maven/plugin/compiler/DependencyCoordinate.java b/src/main/java/org/apache/maven/plugin/compiler/DependencyCoordinate.java index 19609499..593ca5ef 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/DependencyCoordinate.java +++ b/src/main/java/org/apache/maven/plugin/compiler/DependencyCoordinate.java @@ -18,9 +18,6 @@ */ package org.apache.maven.plugin.compiler; -import java.util.Objects; -import java.util.Set; - /** * Simple representation of Maven-coordinates of a dependency. * @@ -38,8 +35,6 @@ public class DependencyCoordinate { private String type = "jar"; - private Set exclusions; - public String getGroupId() { return groupId; } @@ -80,17 +75,16 @@ public void setType(String type) { this.type = type; } - public Set getExclusions() { - return exclusions; - } - - public void setExclusions(Set exclusions) { - this.exclusions = exclusions; - } - @Override public int hashCode() { - return Objects.hash(groupId, artifactId, version, classifier, type, exclusions); + final int prime = 31; + int result = 1; + result = prime * result + ((artifactId == null) ? 0 : artifactId.hashCode()); + result = prime * result + ((classifier == null) ? 0 : classifier.hashCode()); + result = prime * result + ((groupId == null) ? 0 : groupId.hashCode()); + result = prime * result + ((type == null) ? 0 : type.hashCode()); + result = prime * result + ((version == null) ? 0 : version.hashCode()); + return result; } @Override @@ -105,12 +99,42 @@ public boolean equals(Object obj) { return false; } DependencyCoordinate other = (DependencyCoordinate) obj; - return Objects.equals(groupId, other.groupId) - && Objects.equals(artifactId, other.artifactId) - && Objects.equals(version, other.version) - && Objects.equals(classifier, other.classifier) - && Objects.equals(type, other.type) - && Objects.equals(exclusions, other.exclusions); + if (artifactId == null) { + if (other.artifactId != null) { + return false; + } + } else if (!artifactId.equals(other.artifactId)) { + return false; + } + if (classifier == null) { + if (other.classifier != null) { + return false; + } + } else if (!classifier.equals(other.classifier)) { + return false; + } + if (groupId == null) { + if (other.groupId != null) { + return false; + } + } else if (!groupId.equals(other.groupId)) { + return false; + } + if (type == null) { + if (other.type != null) { + return false; + } + } else if (!type.equals(other.type)) { + return false; + } + if (version == null) { + if (other.version != null) { + return false; + } + } else if (!version.equals(other.version)) { + return false; + } + return true; } @Override diff --git a/src/main/java/org/apache/maven/plugin/compiler/IncrementalBuildHelper.java b/src/main/java/org/apache/maven/plugin/compiler/IncrementalBuildHelper.java new file mode 100644 index 00000000..3dc0e2db --- /dev/null +++ b/src/main/java/org/apache/maven/plugin/compiler/IncrementalBuildHelper.java @@ -0,0 +1,204 @@ +/* + * 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. + */ +package org.apache.maven.plugin.compiler; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Collections; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.apache.maven.api.plugin.MojoException; + +/** + * Various helper methods to support incremental builds + */ +public class IncrementalBuildHelper { + /** + * the root directory to store status information about Maven executions in. + */ + private static final String MAVEN_STATUS_ROOT = "maven-status"; + + public static final String CREATED_FILES_LST_FILENAME = "createdFiles.lst"; + private static final String INPUT_FILES_LST_FILENAME = "inputFiles.lst"; + + /** + * Needed for storing the status for the incremental build support. + */ + private final String mojoStatusPath; + + private final Set sources; + + private final Path directory; + + private final Path outputDirectory; + + /** + * Once the {@link #beforeRebuildExecution()} got + * called, this will contain the list of files in the build directory. + */ + private List filesBeforeAction = Collections.emptyList(); + + public IncrementalBuildHelper(String mojoStatusPath, Set sources, Path directory, Path outputDirectory) { + if (mojoStatusPath == null) { + throw new IllegalArgumentException("MojoExecution must not be null!"); + } + + this.mojoStatusPath = mojoStatusPath; + this.sources = sources; + this.directory = directory; + this.outputDirectory = outputDirectory; + } + + /** + * We use a specific status directory for each Mojo execution to store state + * which is needed during the next build invocation run. + * @return the directory for storing status information of the current Mojo execution. + */ + public Path getMojoStatusDirectory() throws MojoException { + // X TODO the executionId contains -cli and -mojoname + // X we should remove those postfixes as it should not make + // X any difference whether being run on the cli or via build + Path mojoStatusDir = directory.resolve(mojoStatusPath); + + try { + Files.createDirectories(mojoStatusDir); + } catch (IOException e) { + throw new MojoException("Unable to create directory: " + mojoStatusDir, e); + } + + return mojoStatusDir; + } + + /** + * Detect whether the list of detected files has changed since the last build. + * We simply load the list of files for the previous build from a status file + * and compare it with the new list. Afterwards we store the new list in the status file. + * + * @return true if the set of inputFiles got changed since the last build. + */ + public boolean inputFileTreeChanged(List added, List removed) { + Path mojoConfigBase = getMojoStatusDirectory(); + Path mojoConfigFile = mojoConfigBase.resolve(INPUT_FILES_LST_FILENAME); + + List oldInputFiles = Collections.emptyList(); + + if (Files.exists(mojoConfigFile)) { + try { + oldInputFiles = Files.readAllLines(mojoConfigFile); + } catch (IOException e) { + throw new MojoException("Error reading old mojo status " + mojoConfigFile, e); + } + } + + List newFiles = + sources.stream().map(Path::toAbsolutePath).map(Path::toString).collect(Collectors.toList()); + + List previousFiles = oldInputFiles; + newFiles.stream().filter(s -> !previousFiles.contains(s)).forEach(added::add); + previousFiles.stream().filter(s -> !newFiles.contains(s)).forEach(removed::add); + try { + Files.write(mojoConfigFile, added); + } catch (IOException e) { + throw new MojoException("Error while storing the mojo status", e); + } + + return added.size() + removed.size() > 0; + } + + /** + *

+ * This method shall get invoked before the actual Mojo task gets triggered, e.g. the actual compile in + * maven-compiler-plugin. + *

+ *

+ * Attention: This method shall only get invoked if the plugin re-creates all the output. + *

+ *

+ * It first picks up the list of files created in the previous build and delete them. This step is necessary to + * prevent left-overs. After that we take a 'directory snapshot' (list of all files which exist in the + * outputDirectory after the clean). + *

+ *

+ * After the actual Mojo task got executed you should invoke the method + * {@link #afterRebuildExecution()} to collect the + * list of files which got changed by this task. + *

+ */ + public void beforeRebuildExecution() { + Path mojoConfigBase = getMojoStatusDirectory(); + Path mojoConfigFile = mojoConfigBase.resolve(CREATED_FILES_LST_FILENAME); + + try { + if (Files.exists(mojoConfigFile)) { + for (String oldFileName : Files.readAllLines(mojoConfigFile)) { + Path oldFile = outputDirectory.resolve(oldFileName); + Files.deleteIfExists(oldFile); + } + } + + // we remember all files which currently exist in the output directory + if (Files.exists(outputDirectory)) { + try (Stream walk = Files.walk(outputDirectory)) { + filesBeforeAction = walk.filter(Files::isRegularFile).collect(Collectors.toList()); + } + } + } catch (IOException e) { + throw new MojoException("Error reading old mojo status", e); + } + } + + /** + *

This method collects and stores all information about files changed since the + * call to {@link #beforeRebuildExecution()}.

+ * + *

Attention: This method shall only get invoked if the plugin re-creates all the output.

+ */ + public void afterRebuildExecution() { + Path mojoConfigBase = getMojoStatusDirectory(); + Path mojoConfigFile = mojoConfigBase.resolve(CREATED_FILES_LST_FILENAME); + + try { + try (Stream walk = Files.walk(outputDirectory)) { + List added = walk.filter(Files::isRegularFile) + .filter(p -> !filesBeforeAction.contains(p)) + .map(Path::toString) + .collect(Collectors.toList()); + + Files.write(mojoConfigFile, added); + } + } catch (IOException e) { + throw new MojoException("Error while storing the mojo status", e); + } + + // in case of clean compile the file is not created so next compile won't see it + // we mus create it here + mojoConfigFile = mojoConfigBase.resolve(INPUT_FILES_LST_FILENAME); + if (!Files.exists(mojoConfigFile)) { + try { + Files.write(mojoConfigFile, sources.stream().map(Path::toString).collect(Collectors.toList())); + } catch (IOException e) { + throw new MojoException("Error while storing the mojo status", e); + } + } + } +} diff --git a/src/main/java/org/apache/maven/plugin/compiler/ModuleInfoTransformer.java b/src/main/java/org/apache/maven/plugin/compiler/ModuleInfoTransformer.java index d03eff3f..79607a3b 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/ModuleInfoTransformer.java +++ b/src/main/java/org/apache/maven/plugin/compiler/ModuleInfoTransformer.java @@ -23,7 +23,7 @@ import java.util.List; import java.util.Set; -import org.apache.maven.plugin.logging.Log; +import org.apache.maven.api.plugin.Log; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.ClassWriter; diff --git a/src/main/java/org/apache/maven/plugin/compiler/Providers.java b/src/main/java/org/apache/maven/plugin/compiler/Providers.java new file mode 100644 index 00000000..c02156b8 --- /dev/null +++ b/src/main/java/org/apache/maven/plugin/compiler/Providers.java @@ -0,0 +1,78 @@ +/* + * 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. + */ +package org.apache.maven.plugin.compiler; + +import java.lang.reflect.Field; +import java.util.Map; + +import org.apache.maven.api.Session; +import org.apache.maven.api.di.Named; +import org.apache.maven.api.di.Provides; +import org.apache.maven.api.services.*; +import org.codehaus.plexus.compiler.Compiler; +import org.codehaus.plexus.compiler.javac.JavacCompiler; +import org.codehaus.plexus.compiler.javac.JavaxToolsCompiler; +import org.codehaus.plexus.compiler.manager.CompilerManager; +import org.codehaus.plexus.compiler.manager.NoSuchCompilerException; + +@Named +class Providers { + + @Provides + static ToolchainManager toolchainManager(Session session) { + return session.getService(ToolchainManager.class); + } + + @Provides + static ArtifactManager artifactManager(Session session) { + return session.getService(ArtifactManager.class); + } + + @Provides + static ProjectManager projectManager(Session session) { + return session.getService(ProjectManager.class); + } + + @Provides + static MessageBuilderFactory messageBuilderFactory(Session session) { + return session.getService(MessageBuilderFactory.class); + } + + @Provides + static CompilerManager compilerManager(Map compilers) { + return compilerId -> { + Compiler compiler = compilers.get(compilerId); + if (compiler == null) { + throw new NoSuchCompilerException(compilerId); + } else { + return compiler; + } + }; + } + + @Provides + @Named("javac") + static Compiler javacCompiler() throws Exception { + JavacCompiler compiler = new JavacCompiler(); + Field ipc = JavacCompiler.class.getDeclaredField("inProcessCompiler"); + ipc.setAccessible(true); + ipc.set(compiler, new JavaxToolsCompiler()); + return compiler; + } +} 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 b8290377..91298e98 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java +++ b/src/main/java/org/apache/maven/plugin/compiler/TestCompilerMojo.java @@ -18,28 +18,30 @@ */ package org.apache.maven.plugin.compiler; -import java.io.File; import java.io.IOException; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Optional; import java.util.Set; - -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 org.apache.maven.shared.utils.StringUtils; -import org.apache.maven.toolchain.Toolchain; -import org.apache.maven.toolchain.java.DefaultJavaToolChain; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.apache.maven.api.JavaToolchain; +import org.apache.maven.api.PathScope; +import org.apache.maven.api.ProjectScope; +import org.apache.maven.api.Toolchain; +import org.apache.maven.api.plugin.MojoException; +import org.apache.maven.api.plugin.annotations.LifecyclePhase; +import org.apache.maven.api.plugin.annotations.Mojo; +import org.apache.maven.api.plugin.annotations.Parameter; import org.codehaus.plexus.compiler.util.scan.SimpleSourceInclusionScanner; import org.codehaus.plexus.compiler.util.scan.SourceInclusionScanner; import org.codehaus.plexus.compiler.util.scan.StaleSourceScanner; @@ -50,19 +52,11 @@ /** * Compiles application test sources. - * By default uses the javac compiler - * of the JDK used to execute Maven. This can be overwritten through Toolchains - * or parameter {@link AbstractCompilerMojo#compilerId}. * * @author Jason van Zyl * @since 2.0 - * @see javac Command */ -@Mojo( - name = "testCompile", - defaultPhase = LifecyclePhase.TEST_COMPILE, - threadSafe = true, - requiresDependencyResolution = ResolutionScope.TEST) +@Mojo(name = "testCompile", defaultPhase = LifecyclePhase.TEST_COMPILE) public class TestCompilerMojo extends AbstractCompilerMojo { /** * Set this to 'true' to bypass compilation of test sources. @@ -74,19 +68,20 @@ public class TestCompilerMojo extends AbstractCompilerMojo { /** * The source directories containing the test-source to be compiled. */ - @Parameter(defaultValue = "${project.testCompileSourceRoots}", readonly = false, required = true) + @Parameter private List compileSourceRoots; /** * The directory where compiled test classes go. - *

- * This parameter should only be modified in special cases. - * See the {@link CompilerMojo#outputDirectory} for more information. - * - * @see CompilerMojo#outputDirectory */ - @Parameter(defaultValue = "${project.build.testOutputDirectory}", required = true, readonly = false) - private File outputDirectory; + @Parameter(defaultValue = "${project.build.outputDirectory}", required = true, readonly = true) + private Path mainOutputDirectory; + + /** + * The directory where compiled test classes go. + */ + @Parameter(defaultValue = "${project.build.testOutputDirectory}", required = true, readonly = true) + private Path outputDirectory; /** * A list of inclusion filters for the compiler. @@ -168,21 +163,9 @@ public class TestCompilerMojo extends AbstractCompilerMojo { * @since 2.2 */ @Parameter(defaultValue = "${project.build.directory}/generated-test-sources/test-annotations") - private File generatedTestSourcesDirectory; + private Path generatedTestSourcesDirectory; - /** - *

- * When {@code true}, uses the module path when compiling with a release or target of 9+ and - * module-info.java or module-info.class is present. - * When {@code false}, always uses the class path. - *

- * - * @since 3.11 - */ - @Parameter(defaultValue = "true") - private boolean useModulePath; - - @Parameter(defaultValue = "${project.testClasspathElements}", readonly = true) + @Parameter private List testPath; /** @@ -196,11 +179,11 @@ public class TestCompilerMojo extends AbstractCompilerMojo { private Map pathElements; - private Collection classpathElements; + private List classpathElements; - private Collection modulepathElements; + private List modulepathElements; - public void execute() throws MojoExecutionException, CompilationFailureException { + public void execute() throws MojoException { if (skip) { getLog().info("Not compiling test sources"); return; @@ -208,8 +191,12 @@ public void execute() throws MojoExecutionException, CompilationFailureException super.execute(); } - protected List getCompileSourceRoots() { - return compileSourceRoots; + protected List getCompileSourceRoots() { + if (compileSourceRoots == null || compileSourceRoots.isEmpty()) { + return projectManager.getCompileSourceRoots(getProject(), ProjectScope.TEST); + } else { + return compileSourceRoots.stream().map(Paths::get).collect(Collectors.toList()); + } } @Override @@ -218,49 +205,58 @@ protected Map getPathElements() { } protected List getClasspathElements() { - return new ArrayList<>(classpathElements); + return classpathElements; } @Override protected List getModulepathElements() { - return new ArrayList<>(modulepathElements); + return modulepathElements; } - protected File getOutputDirectory() { + protected Path getOutputDirectory() { return outputDirectory; } @Override - protected void preparePaths(Set sourceFiles) { - File mainOutputDirectory = new File(getProject().getBuild().getOutputDirectory()); + protected void preparePaths(Set sourceFiles) { + List testPath = this.testPath; + if (testPath == null) { + Stream s1 = Stream.of(outputDirectory.toString(), mainOutputDirectory.toString()); + Stream s2 = session.resolveDependencies(getProject(), PathScope.TEST_COMPILE).stream() + .map(Path::toString); + testPath = Stream.concat(s1, s2).collect(Collectors.toList()); + } + + Path mainOutputDirectory = Paths.get(getProject().getBuild().getOutputDirectory()); - File mainModuleDescriptorClassFile = new File(mainOutputDirectory, "module-info.class"); + Path mainModuleDescriptorClassFile = mainOutputDirectory.resolve("module-info.class"); JavaModuleDescriptor mainModuleDescriptor = null; - File testModuleDescriptorJavaFile = new File("module-info.java"); + Path testModuleDescriptorJavaFile = Paths.get("module-info.java"); JavaModuleDescriptor testModuleDescriptor = null; // Go through the source files to respect includes/excludes - for (File sourceFile : sourceFiles) { + for (Path sourceFile : sourceFiles) { // @todo verify if it is the root of a sourcedirectory? - if ("module-info.java".equals(sourceFile.getName())) { + if ("module-info.java".equals(sourceFile.getFileName().toString())) { testModuleDescriptorJavaFile = sourceFile; break; } } // Get additional information from the main module descriptor, if available - if (mainModuleDescriptorClassFile.exists()) { + if (Files.exists(mainModuleDescriptorClassFile)) { ResolvePathsResult result; try { ResolvePathsRequest request = ResolvePathsRequest.ofStrings(testPath) .setIncludeStatic(true) - .setMainModuleDescriptor(mainModuleDescriptorClassFile.getAbsolutePath()); + .setMainModuleDescriptor( + mainModuleDescriptorClassFile.toAbsolutePath().toString()); - Toolchain toolchain = getToolchain(); - if (toolchain instanceof DefaultJavaToolChain) { - request.setJdkHome(((DefaultJavaToolChain) toolchain).getJavaHome()); + Optional toolchain = getToolchain(); + if (toolchain.isPresent() && toolchain.get() instanceof JavaToolchain) { + request.setJdkHome(((JavaToolchain) toolchain.get()).getJavaHome()); } result = locationManager.resolvePaths(request); @@ -284,21 +280,22 @@ protected void preparePaths(Set sourceFiles) { pathElements = new LinkedHashMap<>(result.getPathElements().size()); pathElements.putAll(result.getPathElements()); - modulepathElements = result.getModulepathElements().keySet(); - classpathElements = result.getClasspathElements(); + modulepathElements = new ArrayList<>(result.getModulepathElements().keySet()); + classpathElements = new ArrayList<>(result.getClasspathElements()); } // Get additional information from the test module descriptor, if available - if (testModuleDescriptorJavaFile.exists()) { + if (Files.exists(testModuleDescriptorJavaFile)) { ResolvePathsResult result; try { ResolvePathsRequest request = ResolvePathsRequest.ofStrings(testPath) - .setMainModuleDescriptor(testModuleDescriptorJavaFile.getAbsolutePath()); + .setMainModuleDescriptor( + testModuleDescriptorJavaFile.toAbsolutePath().toString()); - Toolchain toolchain = getToolchain(); - if (toolchain instanceof DefaultJavaToolChain) { - request.setJdkHome(((DefaultJavaToolChain) toolchain).getJavaHome()); + Optional toolchain = getToolchain(); + if (toolchain.isPresent() && toolchain.get() instanceof JavaToolchain) { + request.setJdkHome(((JavaToolchain) toolchain.get()).getJavaHome()); } result = locationManager.resolvePaths(request); @@ -309,20 +306,14 @@ protected void preparePaths(Set sourceFiles) { testModuleDescriptor = result.getMainModuleDescriptor(); } - if (!useModulePath) { - pathElements = Collections.emptyMap(); - modulepathElements = Collections.emptyList(); - classpathElements = testPath; - return; - } - if (StringUtils.isNotEmpty(getRelease())) { - if (isOlderThanJDK9(getRelease())) { + if (release != null) { + if (Integer.parseInt(release) < 9) { pathElements = Collections.emptyMap(); modulepathElements = Collections.emptyList(); classpathElements = testPath; return; } - } else if (isOlderThanJDK9(getTarget())) { + } else if (Double.parseDouble(getTarget()) < Double.parseDouble(MODULE_INFO_TARGET)) { pathElements = Collections.emptyMap(); modulepathElements = Collections.emptyList(); classpathElements = testPath; @@ -350,8 +341,8 @@ protected void preparePaths(Set sourceFiles) { patchModuleValue.append(testModuleDescriptor.name()); patchModuleValue.append('='); - for (String root : getProject().getCompileSourceRoots()) { - if (Files.exists(Paths.get(root))) { + for (Path root : projectManager.getCompileSourceRoots(getProject(), ProjectScope.MAIN)) { + if (Files.exists(root)) { patchModuleValue.append(root).append(PS); } } @@ -362,7 +353,7 @@ protected void preparePaths(Set sourceFiles) { } } else { // No main binaries available? Means we're a test-only project. - if (!mainOutputDirectory.exists()) { + if (!Files.exists(mainOutputDirectory)) { return; } // very odd @@ -383,7 +374,7 @@ protected void preparePaths(Set sourceFiles) { .append('=') .append(mainOutputDirectory) .append(PS); - for (String root : compileSourceRoots) { + for (Path root : getCompileSourceRoots()) { patchModuleValue.append(root).append(PS); } @@ -436,14 +427,6 @@ protected SourceInclusionScanner getSourceInclusionScanner(String inputFileEndin return scanner; } - static boolean isOlderThanJDK9(String version) { - if (version.startsWith("1.")) { - return Integer.parseInt(version.substring(2)) < 9; - } - - return Integer.parseInt(version) < 9; - } - protected String getSource() { return testSource == null ? source : testSource; } @@ -461,11 +444,7 @@ protected String getCompilerArgument() { return testCompilerArgument == null ? compilerArgument : testCompilerArgument; } - protected Map getCompilerArguments() { - return testCompilerArguments == null ? compilerArguments : testCompilerArguments; - } - - protected File getGeneratedSourcesDirectory() { + protected Path getGeneratedSourcesDirectory() { return generatedTestSourcesDirectory; } diff --git a/src/site/apt/examples/module-info.apt.vm b/src/site/apt/examples/module-info.apt.vm index 09c5f69c..48669a4c 100644 --- a/src/site/apt/examples/module-info.apt.vm +++ b/src/site/apt/examples/module-info.apt.vm @@ -54,8 +54,8 @@ Older projects with module-info In case you want the project to be Java 6, 7 or 8 compatible, you can simply use JDK 9 for both execution blocks. The easiest way is to use Java 9 as the runtime for Maven, by setting <<>> before running <<>>. - But if you want to use an older Java runtime for Maven, you can use the maven-toolchain-plugin to specify the shared JDK - or a custom jdkToolchain and refer to the JDK 9 installation on your system. + But if you want to use an older Java runtime for Maven, you can use the maven-toolchain-plugin to specify the shared JDK (supported since Maven 2.0.9) + or a custom jdkToolchain (supported since Maven 3.3.1) and refer to the JDK 9 installation on your system. +------- @@ -106,9 +106,10 @@ Older projects with module-info * Java 5 or below Compatibility - Given that Maven 3 requires newer Java release at runtime, you'll absolutely need to use Toolchains to use a JDK different from + Given Maven 3 requires newer Java release at runtime, you'll absolutely need to use Toolchains to use a JDK different from Maven runtime. + Be aware that you will need at least Maven 3.3.1 to specify a custom jdkToolchain in your plugin configuration. You could add a jdkToolchain to do base-compile execution-block as well referring to JDK 5. +------- diff --git a/src/site/apt/examples/pass-compiler-arguments.apt.vm b/src/site/apt/examples/pass-compiler-arguments.apt.vm index 46057ff1..d8b9197c 100644 --- a/src/site/apt/examples/pass-compiler-arguments.apt.vm +++ b/src/site/apt/examples/pass-compiler-arguments.apt.vm @@ -28,8 +28,8 @@ Pass Compiler Arguments - Sometimes, you need to pass compiler arguments that are not handled by - the Compiler Plugin itself but are supported by the <<>> selected. + Sometimes, you need to pass other compiler arguments that are not handled by + the Compiler Plugin itself but is supported by the <<>> selected. For such arguments, use the Compiler Plugin's <<>> parameter The following example passes compiler arguments to the <<>> compiler: diff --git a/src/site/apt/examples/set-compiler-release.apt.vm b/src/site/apt/examples/set-compiler-release.apt.vm index 3befe702..671b9d25 100644 --- a/src/site/apt/examples/set-compiler-release.apt.vm +++ b/src/site/apt/examples/set-compiler-release.apt.vm @@ -80,63 +80,3 @@ Setting the <<<--release>>> of the Java Compiler since Java 9. As such, the release number does not start with 1.x anymore. Also note that the supported <<>> targets include the release of the currently used JDK plus a limited number of previous releases. - -* Usage on JDK 8 - - The <<<--release>>> option is not supported using JDK 8. To enable a project that targets Java 8 - to be built using JDK 8 and also JDK 9 or later requires the conditional usage of the - <<<--release>>> option. - - Conditional parametrization is required for the Compiler Plugin version below <<<3.13.0>>> - or compilerId different that <<>>. - - This may be done through the use of a profile: - -+----- - - [...] - - [...] - - set-compiler-release - - [9,) - - - 8 - - - [...] - - [...] - -+----- - - Since version <<<3.13.0>>> of the Compiler Plugin together with the default <<>> compilerId you don't need conditional parametrisation of <<>>. - The <<>> parameter will only be effective for Java 9 or above, otherwise the <<>> and <<>> will be passed to the compiler. - - So you can simply configure as: - -+----- - - [...] - - [...] - - - org.apache.maven.plugins - maven-compiler-plugin - ${project.version} - - 8 - 8 - 8 - - - - [...] - - [...] - -+----- - diff --git a/src/site/apt/index.apt.vm b/src/site/apt/index.apt.vm index c8e2be6a..7162b2b3 100644 --- a/src/site/apt/index.apt.vm +++ b/src/site/apt/index.apt.vm @@ -28,12 +28,12 @@ ${project.name} - The Compiler Plugin is used to compile the sources of your project. The - default compiler used to compile Java sources is javax.tools.JavaCompiler. - If you want to force the plugin to use <<>>, you must configure the plugin option {{{./compile-mojo.html#forceJavacCompilerUse}<<>>}}. + The Compiler Plugin is used to compile the sources of your project. Since 3.0, the + default compiler is javax.tools.JavaCompiler (if you are using java 1.6) and is used to compile Java sources. + If you want to force the plugin using <<>>, you must configure the plugin option {{{./compile-mojo.html#forceJavacCompilerUse}<<>>}}. - Also note that at present the default <<>> setting is <<<1.8>>> and the default <<>> - setting is <<<1.8>>>, independently of the JDK you run Maven with. + Also note that at present the default <<>> setting is <<<1.7>>> and the default <<>> + setting is <<<1.7>>>, independently of the JDK you run Maven with. You are highly encouraged to change these defaults by setting <<>> and <<>> as described in {{{./examples/set-compiler-source-and-target.html}Setting the -source and -target of the Java Compiler}}. @@ -66,7 +66,7 @@ ${project.name} already contain the answer to your question as part of an older thread. Hence, it is also worth browsing/searching the {{{./mailing-lists.html}mail archive}}. - If you feel the plugin is missing a feature or has a defect, you can file a feature request or bug report in our + If you feel like the plugin is missing a feature or has a defect, you can fill a feature request or bug report in our {{{./issue-management.html}issue tracker}}. When creating a new issue, please provide a comprehensive description of your concern. Especially for fixing bugs it is crucial that the developers can reproduce your problem. For this reason, entire debug logs, POMs or most preferably little demo projects attached to the issue are very much appreciated. diff --git a/src/site/apt/non-javac-compilers.apt.vm b/src/site/apt/non-javac-compilers.apt.vm index 95667bdb..b76d0e0e 100644 --- a/src/site/apt/non-javac-compilers.apt.vm +++ b/src/site/apt/non-javac-compilers.apt.vm @@ -31,24 +31,22 @@ Using Non-Javac Compilers Contrary to this plugin's name, the Compiler Plugin does not compile the sources of your project by itself. To compile, the Compiler Plugin uses - another class to compile them. + another class to compile them. The parameter <<>> determines + which class will be used. Currently, the Compiler Plugin is bundled with the + <<>> compiler artifact with artifactId <<>>, + which can be seen as one of the dependencies declared inside the Compiler + Plugin's POM. - The parameter <<>> determines which class will be used. - - Currently, the Compiler Plugin is bundled with the <<>> compiler - with artifactId <<>> version <<${plexusCompilerVersion}>>, - which can be seen as one of the dependencies declared inside the Compiler Plugin's POM. - - {{{https://codehaus-plexus.github.io/plexus-compiler/}Plexus Compiler}} component + {{{http://codehaus-plexus.github.io/plexus-compiler/}Plexus Compiler}} component has some other compiler Ids available under the groupId <<>>: - * <<>> with artifactId <<>> - <>: <<>> and <<>> + * <<>> with artifactId <<>>. - * <<>> with artifactId <<>> - <>: <<>> + * <<>> with artifactId <<>>. - * <<>> with artifactId <<>> - <>: <<>> and <<>> + * <<>> with artifactId <<>>. - * <<>> with artifactId <<>> - <>: <<>> + * <<>> with artifactId <<>>. [] @@ -76,7 +74,7 @@ Using Non-Javac Compilers org.codehaus.plexus plexus-compiler-csharp - ${plexusCompilerVersion} + 1.6
diff --git a/src/site/apt/usage.apt.vm b/src/site/apt/usage.apt.vm index e038356e..789daf77 100644 --- a/src/site/apt/usage.apt.vm +++ b/src/site/apt/usage.apt.vm @@ -75,3 +75,5 @@ mvn test-compile +----- + <>: Maven 3.0 will issue warnings if you do not specify the version of a + plugin. diff --git a/src/site/site.xml b/src/site/site.xml index 3e9ce47a..c93a7291 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -19,9 +19,9 @@ specific language governing permissions and limitations under the License. --> - + xsi:schemaLocation="http://maven.apache.org/DECORATION/1.0.0 http://maven.apache.org/xsd/decoration-1.0.0.xsd"> @@ -29,7 +29,7 @@ under the License. - + diff --git a/src/site/xdoc/download.xml.vm b/src/site/xdoc/download.xml.vm index 8f28f053..3f710359 100644 --- a/src/site/xdoc/download.xml.vm +++ b/src/site/xdoc/download.xml.vm @@ -23,51 +23,102 @@ under the License. Download ${project.name} Source -
-

${project.name} ${project.version} is distributed in source format.

+

${project.name} ${project.version} is distributed in source format. Use a source archive if you intend to build + ${project.name} yourself. Otherwise, simply use the ready-made binary artifacts from central repository.

-

Use a source archive if you intend to build ${project.name} yourself.

+

You will be prompted for a mirror - if the file is not found on yours, please be patient, as it may take 24 + hours to reach all mirrors.

-

Otherwise, simply use the ready-made binary artifacts from central repository.

+

In order to guard against corrupted downloads/installations, it is highly recommended to + verify the signature + of the release bundles against the public KEYS used by the Apache Maven + developers.

-

${project.name} is distributed under the Apache License, version 2.0.

+

${project.name} is distributed under the Apache License, version 2.0.

- - -

This is the current stable version of ${project.name}.

- - - - - - - - - - - - - - - - - - -
LinkChecksumSignature
${project.name} ${project.version} (Source zip)${project.artifactId}-${project.version}-source-release.zip${project.artifactId}-${project.version}-source-release.zip.sha512${project.artifactId}-${project.version}-source-release.zip.asc
- -

It is essential that you verify the integrity of the downloaded file - using the checksum (.sha512 file) - or using the signature (.asc file) against the public KEYS used by the Apache Maven developers. +

We strongly encourage our users to configure a Maven repository mirror closer to their location, please read How to Use Mirrors for Repositories.

+ + + + +

+ [if-any logo] + + logo + + [end] + The currently selected mirror is + [preferred]. + If you encounter a problem with this mirror, + please select another mirror. + If all mirrors are failing, there are + backup + mirrors + (at the end of the mirrors list) that should be available. +

+ +
+ Other mirrors: + + +
+ +

+ You may also consult the + complete list of + mirrors.

+ + + +

This is the current stable version of ${project.name}.

+ + + + + + + + + + + + + + + + + + +
LinkChecksumSignature
${project.name} ${project.version} (Source zip)maven/plugins/${project.artifactId}-${project.version}-source-release.zipmaven/plugins/${project.artifactId}-${project.version}-source-release.zip.sha512maven/plugins/${project.artifactId}-${project.version}-source-release.zip.asc
+
-

It is strongly recommended to use the latest release version of ${project.name} to take advantage of the newest features and bug fixes.

-

Older non-recommended releases can be found on our archive site.

+ +

Older non-recommended releases can be found on our archive site.

+
diff --git a/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTest.java b/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTest.java deleted file mode 100644 index 8d852ba1..00000000 --- a/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTest.java +++ /dev/null @@ -1,301 +0,0 @@ -/* - * 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. - */ -package org.apache.maven.plugin.compiler; - -import java.io.File; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.plugin.compiler.stubs.CompilerManagerStub; -import org.apache.maven.plugin.logging.Log; -import org.apache.maven.plugin.testing.junit5.InjectMojo; -import org.apache.maven.plugin.testing.junit5.MojoTest; -import org.apache.maven.plugin.testing.stubs.ArtifactStub; -import org.junit.jupiter.api.Test; - -import static org.apache.maven.plugin.compiler.MojoTestUtils.getMockMavenProject; -import static org.apache.maven.plugin.compiler.MojoTestUtils.getMockMavenSession; -import static org.apache.maven.plugin.compiler.MojoTestUtils.getMockMojoExecution; -import static org.apache.maven.plugin.compiler.MojoTestUtils.getVariableValueFromObject; -import static org.apache.maven.plugin.compiler.MojoTestUtils.setVariableValueToObject; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.ArgumentMatchers.startsWith; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; - -@MojoTest -class CompilerMojoTest { - - private static final String COMPILE = "compile"; - - /** - * tests the ability of the plugin to compile a basic file - * - * @throws Exception - */ - @Test - @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-basic-test/plugin-config.xml") - void testCompilerBasic(CompilerMojo compilerMojo) throws Exception { - setUpCompilerMojoTestEnv(compilerMojo); - - Log log = mock(Log.class); - - compilerMojo.setLog(log); - - setVariableValueToObject(compilerMojo, "targetOrReleaseSet", false); - compilerMojo.execute(); - - Artifact projectArtifact = getVariableValueFromObject(compilerMojo, "projectArtifact"); - assertNotNull( - projectArtifact.getFile(), - "MCOMPILER-94: artifact file should only be null if there is nothing to compile"); - - File testClass = new File(compilerMojo.getOutputDirectory(), "foo/TestCompile0.class"); - - verify(log).warn(startsWith("No explicit value set for target or release!")); - - assertTrue(testClass::exists); - } - - @Test - @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-basic-sourcetarget/plugin-config.xml") - void testCompilerBasicSourceTarget(CompilerMojo compilerMojo) throws Exception { - setUpCompilerMojoTestEnv(compilerMojo); - - Log log = mock(Log.class); - - compilerMojo.setLog(log); - - compilerMojo.execute(); - - verify(log, never()).warn(startsWith("No explicit value set for target or release!")); - } - - /** - * tests the ability of the plugin to respond to empty source - * - * @throws Exception - */ - @Test - @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-empty-source-test/plugin-config.xml") - void testCompilerEmptySource(CompilerMojo compilerMojo) throws Exception { - setUpCompilerMojoTestEnv(compilerMojo); - - compilerMojo.execute(); - - assertFalse(compilerMojo.getOutputDirectory().exists()); - - Artifact projectArtifact = getVariableValueFromObject(compilerMojo, "projectArtifact"); - assertNull( - projectArtifact.getFile(), "MCOMPILER-94: artifact file should be null if there is nothing to compile"); - } - - /** - * tests the ability of the plugin to respond to includes and excludes correctly - * - * @throws Exception - */ - @Test - @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-includes-excludes-test/plugin-config.xml") - void testCompilerIncludesExcludes(CompilerMojo compilerMojo) throws Exception { - setUpCompilerMojoTestEnv(compilerMojo); - - Set includes = new HashSet<>(); - includes.add("**/TestCompile4*.java"); - setVariableValueToObject(compilerMojo, "includes", includes); - - Set excludes = new HashSet<>(); - excludes.add("**/TestCompile2*.java"); - excludes.add("**/TestCompile3*.java"); - setVariableValueToObject(compilerMojo, "excludes", excludes); - - compilerMojo.execute(); - - File testClass = new File(compilerMojo.getOutputDirectory(), "foo/TestCompile2.class"); - assertFalse(testClass.exists()); - - testClass = new File(compilerMojo.getOutputDirectory(), "foo/TestCompile3.class"); - assertFalse(testClass.exists()); - - testClass = new File(compilerMojo.getOutputDirectory(), "foo/TestCompile4.class"); - assertTrue(testClass.exists()); - } - - /** - * tests the ability of the plugin to fork and successfully compile - * - * @throws Exception - */ - @Test - @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-fork-test/plugin-config.xml") - void testCompilerFork(CompilerMojo compilerMojo) throws Exception { - setUpCompilerMojoTestEnv(compilerMojo); - // JAVA_HOME doesn't have to be on the PATH. - setVariableValueToObject( - compilerMojo, "executable", new File(System.getenv("JAVA_HOME"), "bin/javac").getPath()); - - compilerMojo.execute(); - - File testClass = new File(compilerMojo.getOutputDirectory(), "foo/TestCompile1.class"); - assertTrue(testClass.exists()); - } - - @Test - @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-one-output-file-test/plugin-config.xml") - void testOneOutputFileForAllInput(CompilerMojo compilerMojo) throws Exception { - setUpCompilerMojoTestEnv(compilerMojo); - - setVariableValueToObject(compilerMojo, "compilerManager", new CompilerManagerStub()); - - compilerMojo.execute(); - - File testClass = new File(compilerMojo.getOutputDirectory(), "compiled.class"); - assertTrue(testClass.exists()); - } - - @Test - @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-args-test/plugin-config.xml") - void testCompilerArgs(CompilerMojo compilerMojo) throws Exception { - setUpCompilerMojoTestEnv(compilerMojo); - - setVariableValueToObject(compilerMojo, "compilerManager", new CompilerManagerStub()); - - compilerMojo.execute(); - - File testClass = new File(compilerMojo.getOutputDirectory(), "compiled.class"); - assertTrue(testClass.exists()); - assertEquals( - Arrays.asList("key1=value1", "-Xlint", "-my&special:param-with+chars/not>allowed_in_XML_element_names"), - compilerMojo.compilerArgs); - } - - @Test - @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-implicit-test/plugin-config-none.xml") - void testImplicitFlagNone(CompilerMojo compilerMojo) throws Exception { - setUpCompilerMojoTestEnv(compilerMojo); - - assertEquals("none", compilerMojo.getImplicit()); - } - - @Test - @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-implicit-test/plugin-config-not-set.xml") - void testImplicitFlagNotSet(CompilerMojo compilerMojo) throws Exception { - setUpCompilerMojoTestEnv(compilerMojo); - - assertNull(compilerMojo.getImplicit()); - } - - @Test - @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-one-output-file-test2/plugin-config.xml") - void testOneOutputFileForAllInput2(CompilerMojo compilerMojo) throws Exception { - setUpCompilerMojoTestEnv(compilerMojo); - - setVariableValueToObject(compilerMojo, "compilerManager", new CompilerManagerStub()); - - Set includes = new HashSet<>(); - includes.add("**/TestCompile4*.java"); - setVariableValueToObject(compilerMojo, "includes", includes); - - Set excludes = new HashSet<>(); - excludes.add("**/TestCompile2*.java"); - excludes.add("**/TestCompile3*.java"); - setVariableValueToObject(compilerMojo, "excludes", excludes); - - compilerMojo.execute(); - - File testClass = new File(compilerMojo.getOutputDirectory(), "compiled.class"); - assertTrue(testClass.exists()); - } - - @Test - @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-fail-test/plugin-config.xml") - void testCompileFailure(CompilerMojo compilerMojo) throws Exception { - setUpCompilerMojoTestEnv(compilerMojo); - - setVariableValueToObject(compilerMojo, "compilerManager", new CompilerManagerStub(true)); - - try { - compilerMojo.execute(); - - fail("Should throw an exception"); - } catch (CompilationFailureException e) { - // expected - } - } - - @Test - @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-failonerror-test/plugin-config.xml") - void testCompileFailOnError(CompilerMojo compilerMojo) throws Exception { - setUpCompilerMojoTestEnv(compilerMojo); - - setVariableValueToObject(compilerMojo, "compilerManager", new CompilerManagerStub(true)); - - try { - compilerMojo.execute(); - assertTrue(true); - } catch (CompilationFailureException e) { - fail("The compilation error should have been consumed because failOnError = false"); - } - } - - /** - * Tests that setting 'skipMain' to true skips compilation of the main Java source files, but that test Java source - * files are still compiled. - * @throws Exception - */ - @Test - @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-skip-main/plugin-config.xml") - void testCompileSkipMain(CompilerMojo compilerMojo) throws Exception { - setUpCompilerMojoTestEnv(compilerMojo); - setVariableValueToObject(compilerMojo, "skipMain", true); - compilerMojo.execute(); - File testClass = new File(compilerMojo.getOutputDirectory(), "foo/TestSkipMainCompile0.class"); - assertFalse(testClass.exists()); - } - - /** - * Tests that setting 'skip' to true skips compilation of the test Java source files, but that main Java source - * files are still compiled. - * @throws Exception - */ - @Test - @InjectMojo(goal = COMPILE, pom = "classpath:/unit/compiler-skip-test/plugin-config.xml") - void testCompileSkipTest(CompilerMojo compilerMojo) throws Exception { - setUpCompilerMojoTestEnv(compilerMojo); - - compilerMojo.execute(); - - File testClass = new File(compilerMojo.getOutputDirectory(), "foo/TestSkipTestCompile0.class"); - assertTrue(testClass.exists()); - } - - private void setUpCompilerMojoTestEnv(CompilerMojo mojo) throws Exception { - setVariableValueToObject(mojo, "projectArtifact", new ArtifactStub()); - setVariableValueToObject(mojo, "compilePath", Collections.EMPTY_LIST); - setVariableValueToObject(mojo, "session", getMockMavenSession()); - setVariableValueToObject(mojo, "project", getMockMavenProject()); - setVariableValueToObject(mojo, "mojoExecution", getMockMojoExecution()); - setVariableValueToObject(mojo, "source", AbstractCompilerMojo.DEFAULT_SOURCE); - setVariableValueToObject(mojo, "target", AbstractCompilerMojo.DEFAULT_TARGET); - } -} diff --git a/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java b/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java new file mode 100644 index 00000000..49310ffe --- /dev/null +++ b/src/test/java/org/apache/maven/plugin/compiler/CompilerMojoTestCase.java @@ -0,0 +1,671 @@ +/* + * 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. + */ +package org.apache.maven.plugin.compiler; + +import java.io.File; +import java.net.URI; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.time.Instant; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.maven.api.Artifact; +import org.apache.maven.api.PathScope; +import org.apache.maven.api.Project; +import org.apache.maven.api.Session; +import org.apache.maven.api.di.Inject; +import org.apache.maven.api.di.Provides; +import org.apache.maven.api.di.Singleton; +import org.apache.maven.api.model.Build; +import org.apache.maven.api.model.Model; +import org.apache.maven.api.plugin.Log; +import org.apache.maven.api.plugin.Mojo; +import org.apache.maven.api.plugin.testing.Basedir; +import org.apache.maven.api.plugin.testing.InjectMojo; +import org.apache.maven.api.plugin.testing.MojoExtension; +import org.apache.maven.api.plugin.testing.MojoParameter; +import org.apache.maven.api.plugin.testing.MojoTest; +import org.apache.maven.api.plugin.testing.stubs.ArtifactStub; +import org.apache.maven.api.plugin.testing.stubs.ProjectStub; +import org.apache.maven.api.plugin.testing.stubs.SessionStub; +import org.apache.maven.api.services.ArtifactManager; +import org.apache.maven.api.services.MessageBuilderFactory; +import org.apache.maven.api.services.ProjectManager; +import org.apache.maven.api.services.ToolchainManager; +import org.apache.maven.internal.impl.DefaultMessageBuilderFactory; +import org.apache.maven.internal.impl.InternalSession; +import org.apache.maven.plugin.compiler.stubs.CompilerManagerStub; +import org.codehaus.plexus.languages.java.version.JavaVersion; +import org.junit.jupiter.api.Test; + +import static org.apache.maven.api.plugin.testing.MojoExtension.getBasedir; +import static org.apache.maven.api.plugin.testing.MojoExtension.getVariableValueFromObject; +import static org.apache.maven.api.plugin.testing.MojoExtension.setVariableValueToObject; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.ArgumentMatchers.startsWith; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; + +@MojoTest +public class CompilerMojoTestCase { + + private static final String LOCAL_REPO = "/target/local-repo"; + + @Inject + private Session session; + + /** + * tests the ability of the plugin to compile a basic file + */ + @Test + @Basedir("${basedir}/target/test-classes/unit/compiler-basic-test") + public void testCompilerBasic( + @InjectMojo(goal = "compile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/compile") + CompilerMojo compileMojo, + @InjectMojo(goal = "testCompile", pom = "plugin-config.xml") + @MojoParameter(name = "compileSourceRoots", value = "${project.basedir}/src/test/java") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/testCompile") + TestCompilerMojo testCompileMojo) + throws Exception { + Log log = setMockLogger(compileMojo); + + setVariableValueToObject(compileMojo, "targetOrReleaseSet", Boolean.FALSE); + execute(compileMojo); + + verify(log).warn(startsWith("No explicit value set for target or release!")); + + Path testClass = compileMojo.getOutputDirectory().resolve("TestCompile0.class"); + assertTrue(Files.exists(testClass)); + Artifact projectArtifact = (Artifact) getVariableValueFromObject(compileMojo, "projectArtifact"); + assertNotNull( + session.getArtifactPath(projectArtifact).orElse(null), + "MCOMPILER-94: artifact file should only be null if there is nothing to compile"); + + execute(testCompileMojo); + + testClass = testCompileMojo.getOutputDirectory().resolve("TestCompile0Test.class"); + assertTrue(Files.exists(testClass)); + } + + @Test + @Basedir("${basedir}/target/test-classes/unit/compiler-basic-sourcetarget") + public void testCompilerBasicSourceTarget( + @InjectMojo(goal = "compile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/compile") + CompilerMojo compileMojo) + throws Exception { + Log log = setMockLogger(compileMojo); + + execute(compileMojo); + + verify(log, never()).warn(startsWith("No explicit value set for target or release!")); + } + + /** + * tests the ability of the plugin to respond to empty source + */ + @Test + @Basedir("${basedir}/target/test-classes/unit/compiler-empty-source-test") + public void testCompilerEmptySource( + @InjectMojo(goal = "compile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/compile") + CompilerMojo compileMojo, + @InjectMojo(goal = "testCompile", pom = "plugin-config.xml") + @MojoParameter(name = "compileSourceRoots", value = "${basedir}/src/test/java") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/testCompile") + TestCompilerMojo testCompileMojo) + throws Exception { + execute(compileMojo); + + assertFalse(Files.exists(compileMojo.getOutputDirectory())); + Artifact projectArtifact = (Artifact) getVariableValueFromObject(compileMojo, "projectArtifact"); + assertNull( + session.getArtifactPath(projectArtifact).orElse(null), + "MCOMPILER-94: artifact file should be null if there is nothing to compile"); + + execute(testCompileMojo); + + assertFalse(Files.exists(testCompileMojo.getOutputDirectory())); + } + + /** + * tests the ability of the plugin to respond to includes and excludes correctly + */ + @Test + @Basedir("${basedir}/target/test-classes/unit/compiler-includes-excludes-test") + public void testCompilerIncludesExcludes( + @InjectMojo(goal = "compile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/compile") + CompilerMojo compileMojo, + @InjectMojo(goal = "testCompile", pom = "plugin-config.xml") + @MojoParameter(name = "compileSourceRoots", value = "${project.basedir}/src/test/java") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/testCompile") + TestCompilerMojo testCompileMojo) + throws Exception { + Set includes = new HashSet<>(); + includes.add("**/TestCompile4*.java"); + setVariableValueToObject(compileMojo, "includes", includes); + + Set excludes = new HashSet<>(); + excludes.add("**/TestCompile2*.java"); + excludes.add("**/TestCompile3*.java"); + setVariableValueToObject(compileMojo, "excludes", excludes); + + execute(compileMojo); + + Path testClass = compileMojo.getOutputDirectory().resolve("TestCompile2.class"); + assertFalse(Files.exists(testClass)); + + testClass = compileMojo.getOutputDirectory().resolve("TestCompile3.class"); + assertFalse(Files.exists(testClass)); + + testClass = compileMojo.getOutputDirectory().resolve("TestCompile4.class"); + assertTrue(Files.exists(testClass)); + + setVariableValueToObject(testCompileMojo, "testIncludes", includes); + setVariableValueToObject(testCompileMojo, "testExcludes", excludes); + + execute(testCompileMojo); + + testClass = testCompileMojo.getOutputDirectory().resolve("TestCompile2TestCase.class"); + assertFalse(Files.exists(testClass)); + + testClass = testCompileMojo.getOutputDirectory().resolve("TestCompile3TestCase.class"); + assertFalse(Files.exists(testClass)); + + testClass = testCompileMojo.getOutputDirectory().resolve("TestCompile4TestCase.class"); + assertTrue(Files.exists(testClass)); + } + + /** + * tests the ability of the plugin to fork and successfully compile + */ + @Test + @Basedir("${basedir}/target/test-classes/unit/compiler-fork-test") + public void testCompilerFork( + @InjectMojo(goal = "compile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/compile") + CompilerMojo compileMojo, + @InjectMojo(goal = "testCompile", pom = "plugin-config.xml") + @MojoParameter(name = "compileSourceRoots", value = "${project.basedir}/src/test/java") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/testCompile") + TestCompilerMojo testCompileMojo) + throws Exception { + // JAVA_HOME doesn't have to be on the PATH. + setVariableValueToObject( + compileMojo, "executable", new File(System.getenv("JAVA_HOME"), "bin/javac").getPath()); + + execute(compileMojo); + + Path testClass = compileMojo.getOutputDirectory().resolve("TestCompile1.class"); + assertTrue(Files.exists(testClass)); + + // JAVA_HOME doesn't have to be on the PATH. + setVariableValueToObject( + testCompileMojo, "executable", new File(System.getenv("JAVA_HOME"), "bin/javac").getPath()); + + execute(testCompileMojo); + + testClass = testCompileMojo.getOutputDirectory().resolve("TestCompile1TestCase.class"); + assertTrue(Files.exists(testClass)); + } + + @Test + @Basedir("${basedir}/target/test-classes/unit/compiler-one-output-file-test") + public void testOneOutputFileForAllInput( + @InjectMojo(goal = "compile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/compile") + CompilerMojo compileMojo, + @InjectMojo(goal = "testCompile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/testCompile") + TestCompilerMojo testCompileMojo) + throws Exception { + setVariableValueToObject(compileMojo, "compilerManager", new CompilerManagerStub()); + + execute(compileMojo); + + Path testClass = compileMojo.getOutputDirectory().resolve("compiled.class"); + assertTrue(Files.exists(testClass)); + + setVariableValueToObject(testCompileMojo, "compilerManager", new CompilerManagerStub()); + + setVariableValueToObject( + testCompileMojo, + "compileSourceRoots", + Collections.singletonList( + Paths.get(getBasedir(), "src/test/java").toString())); + execute(testCompileMojo); + + testClass = testCompileMojo.getOutputDirectory().resolve("compiled.class"); + assertTrue(Files.exists(testClass)); + } + + @Test + @Basedir("${basedir}/target/test-classes/unit/compiler-args-test") + public void testCompilerArgs( + @InjectMojo(goal = "compile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/compile") + CompilerMojo compileMojo) + throws Exception { + setVariableValueToObject(compileMojo, "compilerManager", new CompilerManagerStub()); + + execute(compileMojo); + + Path testClass = compileMojo.getOutputDirectory().resolve("compiled.class"); + assertTrue(Files.exists(testClass)); + assertEquals( + Arrays.asList("key1=value1", "-Xlint", "-my&special:param-with+chars/not>allowed_in_XML_element_names"), + compileMojo.compilerArgs); + } + + @Test + @Basedir("${basedir}/target/test-classes/unit/compiler-implicit-test") + public void testImplicitFlagNone( + @InjectMojo(goal = "compile", pom = "plugin-config-none.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/compile") + CompilerMojo compileMojo) + throws Exception { + assertEquals("none", compileMojo.getImplicit()); + } + + @Test + @Basedir("${basedir}/target/test-classes/unit/compiler-implicit-test") + public void testImplicitFlagNotSet( + @InjectMojo(goal = "compile", pom = "plugin-config-not-set.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/compile") + CompilerMojo compileMojo) + throws Exception { + assertNull(compileMojo.getImplicit()); + } + + @Test + @Basedir("${basedir}/target/test-classes/unit/compiler-one-output-file-test2") + public void testOneOutputFileForAllInput2( + @InjectMojo(goal = "compile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/compile") + CompilerMojo compileMojo, + @InjectMojo(goal = "testCompile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/testCompile") + TestCompilerMojo testCompileMojo) + throws Exception { + setVariableValueToObject(compileMojo, "compilerManager", new CompilerManagerStub()); + + Set includes = new HashSet<>(); + includes.add("**/TestCompile4*.java"); + setVariableValueToObject(compileMojo, "includes", includes); + + Set excludes = new HashSet<>(); + excludes.add("**/TestCompile2*.java"); + excludes.add("**/TestCompile3*.java"); + setVariableValueToObject(compileMojo, "excludes", excludes); + + execute(compileMojo); + + Path testClass = compileMojo.getOutputDirectory().resolve("compiled.class"); + assertTrue(Files.exists(testClass)); + + setVariableValueToObject(testCompileMojo, "compilerManager", new CompilerManagerStub()); + setVariableValueToObject(testCompileMojo, "testIncludes", includes); + setVariableValueToObject(testCompileMojo, "testExcludes", excludes); + + setVariableValueToObject( + testCompileMojo, + "compileSourceRoots", + Collections.singletonList( + Paths.get(getBasedir(), "src/test/java").toString())); + execute(testCompileMojo); + + testClass = testCompileMojo.getOutputDirectory().resolve("compiled.class"); + assertTrue(Files.exists(testClass)); + } + + @Test + @Basedir("${basedir}/target/test-classes/unit/compiler-fail-test") + public void testCompileFailure( + @InjectMojo(goal = "compile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/compile") + CompilerMojo compileMojo) + throws Exception { + setVariableValueToObject(compileMojo, "compilerManager", new CompilerManagerStub(true)); + + assertThrows(CompilationFailureException.class, compileMojo::execute, "Should throw an exception"); + } + + @Test + @Basedir("${basedir}/target/test-classes/unit/compiler-failonerror-test") + public void testCompileFailOnError( + @InjectMojo(goal = "compile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/compile") + CompilerMojo compileMojo) + throws Exception { + setVariableValueToObject(compileMojo, "compilerManager", new CompilerManagerStub(true)); + + try { + execute(compileMojo); + assertTrue(true); + } catch (CompilationFailureException e) { + fail("The compilation error should have been consumed because failOnError = false"); + } + } + + /** + * Tests that setting 'skipMain' to true skips compilation of the main Java source files, but that test Java source + * files are still compiled. + */ + @Test + @Basedir("${basedir}/target/test-classes/unit/compiler-skip-main") + public void testCompileSkipMain( + @InjectMojo(goal = "compile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/compile") + CompilerMojo compileMojo, + @InjectMojo(goal = "testCompile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/testCompile") + TestCompilerMojo testCompileMojo) + throws Exception { + setVariableValueToObject(compileMojo, "skipMain", true); + execute(compileMojo); + Path testClass = compileMojo.getOutputDirectory().resolve("TestSkipMainCompile0.class"); + assertFalse(Files.exists(testClass)); + + setVariableValueToObject( + testCompileMojo, + "compileSourceRoots", + Collections.singletonList( + Paths.get(getBasedir(), "src/test/java").toString())); + execute(testCompileMojo); + testClass = testCompileMojo.getOutputDirectory().resolve("TestSkipMainCompile0Test.class"); + assertTrue(Files.exists(testClass)); + } + + /** + * Tests that setting 'skip' to true skips compilation of the test Java source files, but that main Java source + * files are still compiled. + */ + @Test + @Basedir("${basedir}/target/test-classes/unit/compiler-skip-test") + public void testCompileSkipTest( + @InjectMojo(goal = "compile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/compile") + CompilerMojo compileMojo, + @InjectMojo(goal = "testCompile", pom = "plugin-config.xml") + @MojoParameter(name = "mojoStatusPath", value = "maven-status/testCompile") + TestCompilerMojo testCompileMojo) + throws Exception { + execute(compileMojo); + Path testClass = compileMojo.getOutputDirectory().resolve("TestSkipTestCompile0.class"); + assertTrue(Files.exists(testClass)); + + setVariableValueToObject(testCompileMojo, "skip", true); + setVariableValueToObject( + testCompileMojo, + "compileSourceRoots", + Collections.singletonList( + Paths.get(getBasedir(), "src/test/java").toString())); + execute(testCompileMojo); + testClass = testCompileMojo.getOutputDirectory().resolve("TestSkipTestCompile0Test.class"); + assertFalse(Files.exists(testClass)); + } + + @Provides + @Singleton + @SuppressWarnings("unused") + private static InternalSession createSession() { + InternalSession session = SessionStub.getMockSession(getBasedir() + LOCAL_REPO); + + ToolchainManager toolchainManager = mock(ToolchainManager.class); + doReturn(toolchainManager).when(session).getService(ToolchainManager.class); + + doAnswer(iom -> Instant.now().minus(200, ChronoUnit.MILLIS)) + .when(session) + .getStartTime(); + + Artifact junit = new ArtifactStub("junit", "junit", null, "3.8.1", "jar"); + + MessageBuilderFactory messageBuilderFactory = new DefaultMessageBuilderFactory(); + doReturn(messageBuilderFactory).when(session).getService(MessageBuilderFactory.class); + + String source = AbstractCompilerMojo.DEFAULT_SOURCE; + String target = AbstractCompilerMojo.DEFAULT_TARGET; + String javaSpec = System.getProperty("java.specification.version"); + // It is needed to set target/source to JDK 7 for JDK12+ and JDK 8 for JDK17+ + // because this is the lowest version which is supported by those JDK's. + // The default source/target "6" is not supported anymore. + if (JavaVersion.parse(javaSpec).isAtLeast("17")) { + source = "8"; + target = "8"; + } else if (JavaVersion.parse(javaSpec).isAtLeast("12")) { + source = "7"; + target = "7"; + } + + Map props = new HashMap<>(); + props.put("basedir", MojoExtension.getBasedir()); + props.put("maven.compiler.source", source); + props.put("maven.compiler.target", target); + doReturn(props).when(session).getUserProperties(); + + List artifacts = new ArrayList<>(); + try { + Path artifactFile; + String localRepository = System.getProperty("localRepository"); + if (localRepository != null) { + artifactFile = Paths.get(localRepository, "junit/junit/3.8.1/junit-3.8.1.jar"); + } else { + // for IDE + String junitURI = junit.framework.Test.class + .getResource("Test.class") + .toURI() + .toString(); + junitURI = junitURI.substring("jar:".length(), junitURI.indexOf('!')); + artifactFile = new File(URI.create(junitURI)).toPath(); + } + ArtifactManager artifactManager = session.getService(ArtifactManager.class); + artifactManager.setPath(junit, artifactFile); + artifacts.add(artifactFile); + } catch (Exception e) { + throw new RuntimeException("Unable to setup junit jar path", e); + } + + ProjectManager projectManager = session.getService(ProjectManager.class); + doAnswer(iom -> Collections.emptyList()).when(session).resolveDependencies(any(), eq(PathScope.MAIN_COMPILE)); + doAnswer(iom -> artifacts).when(session).resolveDependencies(any(), eq(PathScope.TEST_COMPILE)); + + return session; + } + + @Provides + @Singleton + @SuppressWarnings("unused") + private static Project createProject() { + ProjectStub stub = new ProjectStub(); + ArtifactStub artifact = new ArtifactStub("myGroupId", "myArtifactId", null, "1.0-SNAPSHOT", "jar"); + stub.setMainArtifact(artifact); + stub.setModel(Model.newBuilder() + .groupId(artifact.getGroupId()) + .artifactId(artifact.getArtifactId()) + .version(artifact.getVersion().asString()) + .build(Build.newBuilder() + .directory(MojoExtension.getBasedir() + "/target") + .outputDirectory(MojoExtension.getBasedir() + "/target/classes") + .sourceDirectory(MojoExtension.getBasedir() + "/src/main/java") + .testOutputDirectory(MojoExtension.getBasedir() + "/target/test-classes") + .build()) + .build()); + stub.setBasedir(Paths.get(MojoExtension.getBasedir())); + return stub; + } + + // @Provides + // @SuppressWarnings("unused") + // ProjectManager createProjectManager(InternalSession session) { + // return session.getService(ProjectManager.class); + // } + + // @Provides + // @SuppressWarnings("unused") + // ArtifactManager createArtifactManager(InternalSession session) { + // return session.getService(ArtifactManager.class); + // } + + private Log setMockLogger(AbstractCompilerMojo mojo) throws IllegalAccessException { + Log log = mock(Log.class); + setVariableValueToObject(mojo, "logger", log); + return log; + } + + private static void execute(Mojo mojo) { + try { + mojo.execute(); + } catch (CompilationFailureException e) { + throw new RuntimeException(e.getLongMessage(), e); + } + } + + /* + private CompilerMojo getCompilerMojo( String pomXml ) + throws Exception + { + File testPom = new File( getBasedir(), pomXml ); + + CompilerMojo mojo = (CompilerMojo) lookupMojo( "compile", testPom ); + + setVariableValueToObject( mojo, "projectArtifact", new ArtifactStub() ); + setVariableValueToObject( mojo, "compilePath", Collections.EMPTY_LIST ); + setVariableValueToObject( mojo, "session", getMockMavenSession() ); + setVariableValueToObject( mojo, "project", getMockMavenProject() ); + setVariableValueToObject( mojo, "mojoExecution", getMockMojoExecution() ); + setVariableValueToObject( mojo, "source", source ); + setVariableValueToObject( mojo, "target", target ); + + return mojo; + } + + private TestCompilerMojo getTestCompilerMojo( CompilerMojo compilerMojo, String pomXml ) + throws Exception + { + File testPom = new File( getBasedir(), pomXml ); + + TestCompilerMojo mojo = (TestCompilerMojo) lookupMojo( "testCompile", testPom ); + + setVariableValueToObject( mojo, "log", new DebugEnabledLog() ); + + File buildDir = (File) getVariableValueFromObject( compilerMojo, "buildDirectory" ); + File testClassesDir = new File( buildDir, "test-classes" ); + setVariableValueToObject( mojo, "outputDirectory", testClassesDir ); + + List testClasspathList = new ArrayList<>(); + + Artifact junitArtifact = mock( Artifact.class ); + ArtifactHandler handler = mock( ArtifactHandler.class ); + when( handler.isAddedToClasspath() ).thenReturn( true ); + when( junitArtifact.getArtifactHandler() ).thenReturn( handler ); + + File artifactFile; + String localRepository = System.getProperty( "localRepository" ); + if ( localRepository != null ) + { + artifactFile = new File( localRepository, "junit/junit/3.8.1/junit-3.8.1.jar" ); + } + else + { + // for IDE + String junitURI = org.junit.Test.class.getResource( "Test.class" ).toURI().toString(); + junitURI = junitURI.substring( "jar:".length(), junitURI.indexOf( '!' ) ); + artifactFile = new File( URI.create( junitURI ) ); + } + when ( junitArtifact.getFile() ).thenReturn( artifactFile ); + + testClasspathList.add( artifactFile.getAbsolutePath() ); + testClasspathList.add( compilerMojo.getOutputDirectory().toString() ); + + String testSourceRoot = testPom.getParent() + "/src/test/java"; + setVariableValueToObject( mojo, "compileSourceRoots", Collections.singletonList( testSourceRoot ) ); + + Project project = getMockMavenProject(); + project.setFile( testPom ); + project.addCompileSourceRoot("/src/main/java" ); + project.setArtifacts( Collections.singleton( junitArtifact ) ); + project.getBuild().setOutputDirectory( new File( buildDir, "classes" ).getAbsolutePath() ); + setVariableValueToObject( mojo, "project", project ); + setVariableValueToObject( mojo, "testPath", testClasspathList ); + setVariableValueToObject( mojo, "session", getMockMavenSession() ); + setVariableValueToObject( mojo, "mojoExecution", getMockMojoExecution() ); + setVariableValueToObject( mojo, "source", source ); + setVariableValueToObject( mojo, "target", target ); + + return mojo; + } + + + private MavenProject getMockMavenProject() + { + MavenProject mp = new MavenProject(); + mp.getBuild().setDirectory( "target" ); + mp.getBuild().setOutputDirectory( "target/classes" ); + mp.getBuild().setSourceDirectory( "src/main/java" ); + mp.getBuild().setTestOutputDirectory( "target/test-classes" ); + return mp; + } + + private MavenSession getMockMavenSession() + { + MavenSession session = mock( MavenSession.class ); + // when( session.getPluginContext( isA(PluginDescriptor.class), isA(MavenProject.class) ) ).thenReturn( + // Collections.emptyMap() ); + when( session.getCurrentProject() ).thenReturn( getMockMavenProject() ); + return session; + } + + private MojoExecution getMockMojoExecution() + { + MojoDescriptor md = new MojoDescriptor(); + md.setGoal( "compile" ); + + MojoExecution me = new MojoExecution( md ); + + PluginDescriptor pd = new PluginDescriptor(); + pd.setArtifactId( "maven-compiler-plugin" ); + md.setPluginDescriptor( pd ); + + return me; + } + */ + +} diff --git a/src/test/java/org/apache/maven/plugin/compiler/MojoTestUtils.java b/src/test/java/org/apache/maven/plugin/compiler/MojoTestUtils.java deleted file mode 100644 index 7173d647..00000000 --- a/src/test/java/org/apache/maven/plugin/compiler/MojoTestUtils.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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. - */ -package org.apache.maven.plugin.compiler; - -import java.lang.reflect.Field; - -import org.apache.maven.execution.MavenSession; -import org.apache.maven.plugin.MojoExecution; -import org.apache.maven.plugin.descriptor.MojoDescriptor; -import org.apache.maven.plugin.descriptor.PluginDescriptor; -import org.apache.maven.project.MavenProject; -import org.codehaus.plexus.util.ReflectionUtils; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class MojoTestUtils { - - public static T getVariableValueFromObject(Object object, String variable) throws IllegalAccessException { - Field field = ReflectionUtils.getFieldByNameIncludingSuperclasses(variable, object.getClass()); - field.setAccessible(true); - return (T) field.get(object); - } - - public static void setVariableValueToObject(Object object, String variable, T value) - throws IllegalAccessException { - Field field = ReflectionUtils.getFieldByNameIncludingSuperclasses(variable, object.getClass()); - field.setAccessible(true); - field.set(object, value); - } - - public static MavenProject getMockMavenProject() { - MavenProject mp = new MavenProject(); - mp.getBuild().setDirectory("target"); - mp.getBuild().setOutputDirectory("target/classes"); - mp.getBuild().setSourceDirectory("src/main/java"); - mp.getBuild().setTestOutputDirectory("target/test-classes"); - return mp; - } - - public static MavenSession getMockMavenSession() { - MavenSession session = mock(MavenSession.class); - // when( session.getPluginContext( isA(PluginDescriptor.class), isA(MavenProject.class) ) ).thenReturn( - // Collections.emptyMap() ); - when(session.getCurrentProject()).thenReturn(getMockMavenProject()); - return session; - } - - public static MojoExecution getMockMojoExecution() { - MojoDescriptor md = new MojoDescriptor(); - MojoExecution me = new MojoExecution(md); - - PluginDescriptor pd = new PluginDescriptor(); - pd.setArtifactId("maven-compiler-plugin"); - md.setPluginDescriptor(pd); - - return me; - } -} diff --git a/src/test/java/org/apache/maven/plugin/compiler/TestCompilerMojoTest.java b/src/test/java/org/apache/maven/plugin/compiler/TestCompilerMojoTest.java deleted file mode 100644 index 31a2e2a3..00000000 --- a/src/test/java/org/apache/maven/plugin/compiler/TestCompilerMojoTest.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * 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. - */ -package org.apache.maven.plugin.compiler; - -import java.io.File; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Set; -import java.util.stream.Stream; - -import org.apache.maven.plugin.compiler.stubs.CompilerManagerStub; -import org.apache.maven.plugin.testing.junit5.InjectMojo; -import org.apache.maven.plugin.testing.junit5.MojoTest; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; - -import static org.apache.maven.plugin.compiler.MojoTestUtils.getMockMavenProject; -import static org.apache.maven.plugin.compiler.MojoTestUtils.getMockMavenSession; -import static org.apache.maven.plugin.compiler.MojoTestUtils.getMockMojoExecution; -import static org.apache.maven.plugin.compiler.MojoTestUtils.getVariableValueFromObject; -import static org.apache.maven.plugin.compiler.MojoTestUtils.setVariableValueToObject; -import static org.junit.jupiter.api.Assertions.*; - -@MojoTest -class TestCompilerMojoTest { - - private static final String TEST_COMPILE = "testCompile"; - - @Test - @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-basic-test/plugin-config.xml") - void testCompilerBasic(TestCompilerMojo testCompilerMojo) throws Exception { - setUpCompilerMojoTestEnv(testCompilerMojo); - - testCompilerMojo.execute(); - - File testClass = new File(testCompilerMojo.getOutputDirectory(), "foo/TestCompile0Test.class"); - - assertTrue(testClass::exists); - } - - @Test - @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-empty-source-test/plugin-config.xml") - public void testCompilerEmptySource(TestCompilerMojo testCompilerMojo) throws Exception { - setUpCompilerMojoTestEnv(testCompilerMojo); - - testCompilerMojo.execute(); - - assertFalse(testCompilerMojo.getOutputDirectory().exists()); - } - - @Test - @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-includes-excludes-test/plugin-config.xml") - void testCompilerIncludesExcludes(TestCompilerMojo testCompilerMojo) throws Exception { - setUpCompilerMojoTestEnv(testCompilerMojo); - - Set includes = new HashSet<>(); - includes.add("**/TestCompile4*.java"); - setVariableValueToObject(testCompilerMojo, "testIncludes", includes); - - Set excludes = new HashSet<>(); - excludes.add("**/TestCompile2*.java"); - excludes.add("**/TestCompile3*.java"); - setVariableValueToObject(testCompilerMojo, "testExcludes", excludes); - - testCompilerMojo.execute(); - - File testClass = new File(testCompilerMojo.getOutputDirectory(), "foo/TestCompile2TestCase.class"); - assertFalse(testClass.exists()); - - testClass = new File(testCompilerMojo.getOutputDirectory(), "foo/TestCompile3TestCase.class"); - assertFalse(testClass.exists()); - - testClass = new File(testCompilerMojo.getOutputDirectory(), "foo/TestCompile4TestCase.class"); - assertTrue(testClass.exists()); - } - - @Test - @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-fork-test/plugin-config.xml") - void testCompilerFork(TestCompilerMojo testCompilerMojo) throws Exception { - setUpCompilerMojoTestEnv(testCompilerMojo); - - // JAVA_HOME doesn't have to be on the PATH. - setVariableValueToObject( - testCompilerMojo, "executable", new File(System.getenv("JAVA_HOME"), "bin/javac").getPath()); - - testCompilerMojo.execute(); - - File testClass = new File(testCompilerMojo.getOutputDirectory(), "foo/TestCompile1TestCase.class"); - assertTrue(testClass.exists()); - } - - @Test - @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-one-output-file-test/plugin-config.xml") - void testOneOutputFileForAllInput(TestCompilerMojo testCompilerMojo) throws Exception { - setUpCompilerMojoTestEnv(testCompilerMojo); - - setVariableValueToObject(testCompilerMojo, "compilerManager", new CompilerManagerStub()); - - testCompilerMojo.execute(); - - File testClass = new File(testCompilerMojo.getOutputDirectory(), "compiled.class"); - assertTrue(testClass.exists()); - } - - @Test - @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-one-output-file-test2/plugin-config.xml") - void testOneOutputFileForAllInput2(TestCompilerMojo testCompilerMojo) throws Exception { - setUpCompilerMojoTestEnv(testCompilerMojo); - - setVariableValueToObject(testCompilerMojo, "compilerManager", new CompilerManagerStub()); - - Set includes = new HashSet<>(); - includes.add("**/TestCompile4*.java"); - setVariableValueToObject(testCompilerMojo, "testIncludes", includes); - - Set excludes = new HashSet<>(); - excludes.add("**/TestCompile2*.java"); - excludes.add("**/TestCompile3*.java"); - setVariableValueToObject(testCompilerMojo, "testExcludes", excludes); - - testCompilerMojo.execute(); - - File testClass = new File(testCompilerMojo.getOutputDirectory(), "compiled.class"); - assertTrue(testClass.exists()); - } - - @Test - @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-skip-main/plugin-config.xml") - void testCompileSkipMain(TestCompilerMojo testCompilerMojo) throws Exception { - setUpCompilerMojoTestEnv(testCompilerMojo); - - testCompilerMojo.execute(); - - File testClass = new File(testCompilerMojo.getOutputDirectory(), "foo/TestSkipMainCompile0Test.class"); - assertTrue(testClass.exists()); - } - - @Test - @InjectMojo(goal = TEST_COMPILE, pom = "classpath:/unit/compiler-skip-test/plugin-config.xml") - void testCompileSkipTest(TestCompilerMojo testCompilerMojo) throws Exception { - setUpCompilerMojoTestEnv(testCompilerMojo); - - setVariableValueToObject(testCompilerMojo, "skip", true); - - testCompilerMojo.execute(); - - File testClass = new File(testCompilerMojo.getOutputDirectory(), "foo/TestSkipTestCompile0Test.class"); - assertFalse(testClass.exists()); - } - - private void setUpCompilerMojoTestEnv(TestCompilerMojo mojo) throws Exception { - File buildDir = getVariableValueFromObject(mojo, "buildDirectory"); - File testClassesDir = new File(buildDir, "test-classes"); - setVariableValueToObject(mojo, "outputDirectory", testClassesDir); - - setVariableValueToObject(mojo, "project", getMockMavenProject()); - - Path baseDir = mojo.getOutputDirectory() - .toPath() - .resolveSibling(Paths.get("..", "..", "..", "..", "test-classes")) - .normalize(); - Path subpath = mojo.getOutputDirectory().toPath().subpath(baseDir.getNameCount(), baseDir.getNameCount() + 2); - String sourceRoot = baseDir.resolve(subpath) + "/src/main/java"; - String testSourceRoot = baseDir.resolve(subpath) + "/src/test/java"; - - setVariableValueToObject(mojo, "compileSourceRoots", Arrays.asList(sourceRoot, testSourceRoot)); - - setVariableValueToObject(mojo, "session", getMockMavenSession()); - setVariableValueToObject(mojo, "mojoExecution", getMockMojoExecution()); - setVariableValueToObject(mojo, "source", AbstractCompilerMojo.DEFAULT_SOURCE); - setVariableValueToObject(mojo, "target", AbstractCompilerMojo.DEFAULT_TARGET); - } - - static Stream olderThanJDK9() { - return Stream.of( - Arguments.of("1.8", true), - Arguments.of("8", true), - Arguments.of("1.9", false), - Arguments.of("1.9", false), - Arguments.of("9", false), - Arguments.of("11", false)); - } - - @ParameterizedTest - @MethodSource - void olderThanJDK9(String version, boolean expected) { - assertEquals(expected, TestCompilerMojo.isOlderThanJDK9(version)); - } -} diff --git a/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerManagerStub.java b/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerManagerStub.java index 59f0a839..0b707440 100644 --- a/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerManagerStub.java +++ b/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerManagerStub.java @@ -18,6 +18,25 @@ */ package org.apache.maven.plugin.compiler.stubs; +/* + * 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 org.codehaus.plexus.compiler.manager.CompilerManager; /** diff --git a/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerStub.java b/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerStub.java index 8131fa77..79efc6ab 100644 --- a/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerStub.java +++ b/src/test/java/org/apache/maven/plugin/compiler/stubs/CompilerStub.java @@ -18,11 +18,32 @@ */ package org.apache.maven.plugin.compiler.stubs; +/* + * 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 java.io.File; import java.io.IOException; import java.util.Collections; +import java.util.List; import org.codehaus.plexus.compiler.CompilerConfiguration; +import org.codehaus.plexus.compiler.CompilerError; import org.codehaus.plexus.compiler.CompilerException; import org.codehaus.plexus.compiler.CompilerMessage; import org.codehaus.plexus.compiler.CompilerOutputStyle; @@ -62,6 +83,23 @@ public boolean canUpdateTarget(CompilerConfiguration compilerConfiguration) { return false; } + public List compile(CompilerConfiguration compilerConfiguration) throws CompilerException { + File outputDir = new File(compilerConfiguration.getOutputLocation()); + + try { + outputDir.mkdirs(); + + File outputFile = new File(outputDir, "compiled.class"); + if (!outputFile.exists() && !outputFile.createNewFile()) { + throw new CompilerException("could not create output file: " + outputFile.getAbsolutePath()); + } + } catch (IOException e) { + throw new CompilerException("An exception occurred while creating output file", e); + } + + return Collections.singletonList(new CompilerError("message 1", shouldFail)); + } + public CompilerResult performCompile(CompilerConfiguration compilerConfiguration) throws CompilerException { File outputDir = new File(compilerConfiguration.getOutputLocation()); diff --git a/src/test/java/org/apache/maven/plugin/compiler/stubs/DebugEnabledLog.java b/src/test/java/org/apache/maven/plugin/compiler/stubs/DebugEnabledLog.java deleted file mode 100644 index 4663fa18..00000000 --- a/src/test/java/org/apache/maven/plugin/compiler/stubs/DebugEnabledLog.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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. - */ -package org.apache.maven.plugin.compiler.stubs; - -import org.apache.maven.plugin.logging.SystemStreamLog; - -/** - * @author Edwin Punzalan - */ -public class DebugEnabledLog extends SystemStreamLog { - public DebugEnabledLog() { - super(); - } - - public boolean isDebugEnabled() { - return true; - } -} diff --git a/src/test/resources/unit/compiler-args-test/plugin-config.xml b/src/test/resources/unit/compiler-args-test/plugin-config.xml index ea541356..d6d6d17f 100644 --- a/src/test/resources/unit/compiler-args-test/plugin-config.xml +++ b/src/test/resources/unit/compiler-args-test/plugin-config.xml @@ -24,12 +24,13 @@ maven-compiler-plugin - ${basedir}/target/test-classes/unit/compiler-args-test/src/main/java + ${project.basedir}/src/main/java javac true - ${basedir}/target/test/unit/compiler-args-test/target/classes - ${basedir}/target/test/unit/compiler-args-test/target + ${project.basedir}/target + ${project.basedir}/target/classes + ${project.basedir}/target/test-classes value1 diff --git a/src/test/resources/unit/compiler-args-test/src/main/java/TestCompile0.java b/src/test/resources/unit/compiler-args-test/src/main/java/TestCompile0.java index 1ccfd289..44c03597 100644 --- a/src/test/resources/unit/compiler-args-test/src/main/java/TestCompile0.java +++ b/src/test/resources/unit/compiler-args-test/src/main/java/TestCompile0.java @@ -16,12 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class TestCompile0 { +public class TestCompile0 +{ - public TestCompile0() { + public TestCompile0() + { - System.out.println("Woo Hoo!"); + System.out.println( "Woo Hoo!" ); } -} + +} \ No newline at end of file diff --git a/src/test/resources/unit/compiler-args-test/src/test/java/TestCompile0Test.java b/src/test/resources/unit/compiler-args-test/src/test/java/TestCompile0Test.java index 264b6ab0..5df6d4f5 100644 --- a/src/test/resources/unit/compiler-args-test/src/test/java/TestCompile0Test.java +++ b/src/test/resources/unit/compiler-args-test/src/test/java/TestCompile0Test.java @@ -16,10 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class TestCompile0Test { - public void testCompile0Test() { +import junit.framework.TestCase; + +public class TestCompile0Test + extends TestCase +{ + public void testCompile0Test() + { TestCompile0 test = new TestCompile0(); } -} +} \ No newline at end of file diff --git a/src/test/resources/unit/compiler-basic-sourcetarget/plugin-config.xml b/src/test/resources/unit/compiler-basic-sourcetarget/plugin-config.xml index b4059e06..cf09fbc8 100644 --- a/src/test/resources/unit/compiler-basic-sourcetarget/plugin-config.xml +++ b/src/test/resources/unit/compiler-basic-sourcetarget/plugin-config.xml @@ -24,14 +24,12 @@ maven-compiler-plugin - ${basedir}/target/test-classes/unit/compiler-basic-test/src/main/java + ${project.basedir}/src/main/java javac true - ${basedir}/target/test/unit/compiler-basic-test/target/classes - ${basedir}/target/test/unit/compiler-basic-test/target - 1.6 - 1.6 + ${project.basedir}/target + ${project.basedir}/target/classes diff --git a/src/test/resources/unit/compiler-basic-sourcetarget/src/main/java/TestCompile0.java b/src/test/resources/unit/compiler-basic-sourcetarget/src/main/java/TestCompile0.java index 1ccfd289..44c03597 100644 --- a/src/test/resources/unit/compiler-basic-sourcetarget/src/main/java/TestCompile0.java +++ b/src/test/resources/unit/compiler-basic-sourcetarget/src/main/java/TestCompile0.java @@ -16,12 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class TestCompile0 { +public class TestCompile0 +{ - public TestCompile0() { + public TestCompile0() + { - System.out.println("Woo Hoo!"); + System.out.println( "Woo Hoo!" ); } -} + +} \ No newline at end of file diff --git a/src/test/resources/unit/compiler-basic-test/plugin-config.xml b/src/test/resources/unit/compiler-basic-test/plugin-config.xml index 5ed0fece..13c4512e 100644 --- a/src/test/resources/unit/compiler-basic-test/plugin-config.xml +++ b/src/test/resources/unit/compiler-basic-test/plugin-config.xml @@ -19,17 +19,18 @@ + ${project.basedir}/target + ${project.basedir}/target/classes + ${project.basedir}/target/test-classes maven-compiler-plugin - ${basedir}/target/test-classes/unit/compiler-basic-test/src/main/java + ${project.basedir}/src/main/java javac true - ${basedir}/target/test/unit/compiler-basic-test/target/classes - ${basedir}/target/test/unit/compiler-basic-test/target diff --git a/src/test/resources/unit/compiler-basic-test/src/main/java/TestCompile0.java b/src/test/resources/unit/compiler-basic-test/src/main/java/TestCompile0.java index 1ccfd289..44c03597 100644 --- a/src/test/resources/unit/compiler-basic-test/src/main/java/TestCompile0.java +++ b/src/test/resources/unit/compiler-basic-test/src/main/java/TestCompile0.java @@ -16,12 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class TestCompile0 { +public class TestCompile0 +{ - public TestCompile0() { + public TestCompile0() + { - System.out.println("Woo Hoo!"); + System.out.println( "Woo Hoo!" ); } -} + +} \ No newline at end of file diff --git a/src/test/resources/unit/compiler-basic-test/src/test/java/TestCompile0Test.java b/src/test/resources/unit/compiler-basic-test/src/test/java/TestCompile0Test.java index 264b6ab0..5df6d4f5 100644 --- a/src/test/resources/unit/compiler-basic-test/src/test/java/TestCompile0Test.java +++ b/src/test/resources/unit/compiler-basic-test/src/test/java/TestCompile0Test.java @@ -16,10 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class TestCompile0Test { - public void testCompile0Test() { +import junit.framework.TestCase; + +public class TestCompile0Test + extends TestCase +{ + public void testCompile0Test() + { TestCompile0 test = new TestCompile0(); } -} +} \ No newline at end of file diff --git a/src/test/resources/unit/compiler-empty-source-test/plugin-config.xml b/src/test/resources/unit/compiler-empty-source-test/plugin-config.xml index 7e47c2f1..7d7a2461 100644 --- a/src/test/resources/unit/compiler-empty-source-test/plugin-config.xml +++ b/src/test/resources/unit/compiler-empty-source-test/plugin-config.xml @@ -24,13 +24,15 @@ maven-compiler-plugin - ${basedir}/target/test-classes/unit/compiler-empty-source-test/src/main/java - + ${project.basedir}/src/main/java javac true - ${basedir}/target/test/unit/compiler-empty-source-test/target/classes - ${basedir}/target/test/unit/compiler-empty-source-test/target + ${project.basedir}/target + ${project.basedir}/target/classes + ${project.basedir}/target/test-classes + 8 + 8 diff --git a/src/test/resources/unit/compiler-fail-test/plugin-config.xml b/src/test/resources/unit/compiler-fail-test/plugin-config.xml index 7f24e86e..13c4512e 100644 --- a/src/test/resources/unit/compiler-fail-test/plugin-config.xml +++ b/src/test/resources/unit/compiler-fail-test/plugin-config.xml @@ -19,17 +19,18 @@ + ${project.basedir}/target + ${project.basedir}/target/classes + ${project.basedir}/target/test-classes maven-compiler-plugin - ${basedir}/target/test-classes/unit/compiler-fail-test/src/main/java + ${project.basedir}/src/main/java javac true - ${basedir}/target/test/unit/compiler-fail-test/target/classes - ${basedir}/target/test/unit/compiler-fail-test/target diff --git a/src/test/resources/unit/compiler-fail-test/src/main/java/TestCompile0.java b/src/test/resources/unit/compiler-fail-test/src/main/java/TestCompile0.java index 1ccfd289..44c03597 100644 --- a/src/test/resources/unit/compiler-fail-test/src/main/java/TestCompile0.java +++ b/src/test/resources/unit/compiler-fail-test/src/main/java/TestCompile0.java @@ -16,12 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class TestCompile0 { +public class TestCompile0 +{ - public TestCompile0() { + public TestCompile0() + { - System.out.println("Woo Hoo!"); + System.out.println( "Woo Hoo!" ); } -} + +} \ No newline at end of file diff --git a/src/test/resources/unit/compiler-fail-test/src/test/java/TestCompile0Test.java b/src/test/resources/unit/compiler-fail-test/src/test/java/TestCompile0Test.java index 264b6ab0..5df6d4f5 100644 --- a/src/test/resources/unit/compiler-fail-test/src/test/java/TestCompile0Test.java +++ b/src/test/resources/unit/compiler-fail-test/src/test/java/TestCompile0Test.java @@ -16,10 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class TestCompile0Test { - public void testCompile0Test() { +import junit.framework.TestCase; + +public class TestCompile0Test + extends TestCase +{ + public void testCompile0Test() + { TestCompile0 test = new TestCompile0(); } -} +} \ No newline at end of file diff --git a/src/test/resources/unit/compiler-failonerror-test/plugin-config.xml b/src/test/resources/unit/compiler-failonerror-test/plugin-config.xml index 512d56dc..34467014 100644 --- a/src/test/resources/unit/compiler-failonerror-test/plugin-config.xml +++ b/src/test/resources/unit/compiler-failonerror-test/plugin-config.xml @@ -25,12 +25,13 @@ false - ${basedir}/target/test-classes/unit/compiler-fail-test/src/main/java + ${project.basedir}/src/main/java javac true - ${basedir}/target/test/unit/compiler-fail-test/target/classes - ${basedir}/target/test/unit/compiler-fail-test/target + ${project.basedir}/target + ${project.basedir}/target/classes + ${project.basedir}/target/test-classes diff --git a/src/test/resources/unit/compiler-failonerror-test/src/main/java/TestCompile0.java b/src/test/resources/unit/compiler-failonerror-test/src/main/java/TestCompile0.java index 1ccfd289..44c03597 100644 --- a/src/test/resources/unit/compiler-failonerror-test/src/main/java/TestCompile0.java +++ b/src/test/resources/unit/compiler-failonerror-test/src/main/java/TestCompile0.java @@ -16,12 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class TestCompile0 { +public class TestCompile0 +{ - public TestCompile0() { + public TestCompile0() + { - System.out.println("Woo Hoo!"); + System.out.println( "Woo Hoo!" ); } -} + +} \ No newline at end of file diff --git a/src/test/resources/unit/compiler-failonerror-test/src/test/java/TestCompile0Test.java b/src/test/resources/unit/compiler-failonerror-test/src/test/java/TestCompile0Test.java index 264b6ab0..5df6d4f5 100644 --- a/src/test/resources/unit/compiler-failonerror-test/src/test/java/TestCompile0Test.java +++ b/src/test/resources/unit/compiler-failonerror-test/src/test/java/TestCompile0Test.java @@ -16,10 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class TestCompile0Test { - public void testCompile0Test() { +import junit.framework.TestCase; + +public class TestCompile0Test + extends TestCase +{ + public void testCompile0Test() + { TestCompile0 test = new TestCompile0(); } -} +} \ No newline at end of file diff --git a/src/test/resources/unit/compiler-fork-test/plugin-config.xml b/src/test/resources/unit/compiler-fork-test/plugin-config.xml index 99bd0364..f9459426 100644 --- a/src/test/resources/unit/compiler-fork-test/plugin-config.xml +++ b/src/test/resources/unit/compiler-fork-test/plugin-config.xml @@ -24,16 +24,18 @@ maven-compiler-plugin true + 8 + 8 - ${basedir} + ${project.basedir} 64m 128m true true - ${basedir}/target/test-classes/unit/compiler-fork-test/src/main/java + ${project.basedir}/src/main/java javac true @@ -43,8 +45,9 @@ This value would have been better, but ${env.JAVA_HOME} can't be resolved. So it is adjusted in org.apache.maven.plugin.compiler.CompilerMojoTestCase.testCompilerFork() --> - ${basedir}/target/test/unit/compiler-fork-test/target/classes - ${basedir}/target/test/unit/compiler-fork-test/target + ${project.basedir}/target + ${project.basedir}/target/classes + ${project.basedir}/target/test-classes diff --git a/src/test/resources/unit/compiler-fork-test/src/main/java/TestCompile1.java b/src/test/resources/unit/compiler-fork-test/src/main/java/TestCompile1.java index bbc5f788..4e4ded81 100644 --- a/src/test/resources/unit/compiler-fork-test/src/main/java/TestCompile1.java +++ b/src/test/resources/unit/compiler-fork-test/src/main/java/TestCompile1.java @@ -16,12 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class TestCompile1 { +public class TestCompile1 +{ - public TestCompile1() { + public TestCompile1() + { - System.out.println("Woo Hoo!"); + System.out.println( "Woo Hoo!" ); } -} + +} \ No newline at end of file diff --git a/src/test/resources/unit/compiler-fork-test/src/test/java/TestCompile1TestCase.java b/src/test/resources/unit/compiler-fork-test/src/test/java/TestCompile1TestCase.java index 2121488d..ede2355c 100644 --- a/src/test/resources/unit/compiler-fork-test/src/test/java/TestCompile1TestCase.java +++ b/src/test/resources/unit/compiler-fork-test/src/test/java/TestCompile1TestCase.java @@ -16,10 +16,14 @@ * specific language governing permissions and limitations * under the License. */ -package foo; -public class TestCompile1TestCase { - public void testCompile1() { +import junit.framework.TestCase; + +public class TestCompile1TestCase + extends TestCase +{ + public void testCompile1() + { TestCompile1 test = new TestCompile1(); } -} +} \ No newline at end of file diff --git a/src/test/resources/unit/compiler-implicit-test/plugin-config-none.xml b/src/test/resources/unit/compiler-implicit-test/plugin-config-none.xml index faf33341..c90ee61b 100644 --- a/src/test/resources/unit/compiler-implicit-test/plugin-config-none.xml +++ b/src/test/resources/unit/compiler-implicit-test/plugin-config-none.xml @@ -24,12 +24,13 @@ maven-compiler-plugin - ${basedir}/target/test-classes/unit/compiler-implicit-test/src/main/java + ${project.basedir}/src/main/java javac true - ${basedir}/target/test/unit/compiler-implicit-test/target/classes - ${basedir}/target/test/unit/compiler-implicit-test/target + ${project.basedir}/target + ${project.basedir}/target/classes + ${project.basedir}/target/test-classes none diff --git a/src/test/resources/unit/compiler-implicit-test/plugin-config-not-set.xml b/src/test/resources/unit/compiler-implicit-test/plugin-config-not-set.xml index 1ad147b6..64e1e7fb 100644 --- a/src/test/resources/unit/compiler-implicit-test/plugin-config-not-set.xml +++ b/src/test/resources/unit/compiler-implicit-test/plugin-config-not-set.xml @@ -24,12 +24,13 @@ maven-compiler-plugin - ${basedir}/target/test-classes/unit/compiler-implicit-test/src/main/java + ${project.basedir}/src/main/java javac true - ${basedir}/target/test/unit/compiler-implicit-test/target/classes - ${basedir}/target/test/unit/compiler-implicit-test/target + ${project.basedir}/target + ${project.basedir}/target/classes + ${project.basedir}/target/test-classes diff --git a/src/test/resources/unit/compiler-includes-excludes-test/plugin-config.xml b/src/test/resources/unit/compiler-includes-excludes-test/plugin-config.xml index a773b718..d248ec8d 100644 --- a/src/test/resources/unit/compiler-includes-excludes-test/plugin-config.xml +++ b/src/test/resources/unit/compiler-includes-excludes-test/plugin-config.xml @@ -19,13 +19,15 @@ + ${project.basedir}/target + ${project.basedir}/target/classes + ${project.basedir}/target/test-classes maven-compiler-plugin - ${basedir}/target/test-classes/unit/compiler-includes-excludes-test/src/main/java - + ${project.basedir}/src/main/java