From 6fd3a46885edd81e62ae62cfc798c1e1b903e170 Mon Sep 17 00:00:00 2001 From: Karl Heinz Marbaise Date: Sun, 28 Apr 2019 14:06:25 +0200 Subject: [PATCH] [MCOMPILER-379] - Fatal error compiling: basedir ... arget/generated-sources/annotations does not exist - Created Integration test which currently fails. --- src/it/MCOMPILER-379/invoker.properties | 18 +++++++ src/it/MCOMPILER-379/module1/pom.xml | 42 +++++++++++++++ src/it/MCOMPILER-379/module2/pom.xml | 36 +++++++++++++ .../src/main/java/com/natros/mcp/Foo.java | 22 ++++++++ src/it/MCOMPILER-379/pom.xml | 54 +++++++++++++++++++ .../plugin/compiler/AbstractCompilerMojo.java | 7 ++- 6 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 src/it/MCOMPILER-379/invoker.properties create mode 100644 src/it/MCOMPILER-379/module1/pom.xml create mode 100644 src/it/MCOMPILER-379/module2/pom.xml create mode 100644 src/it/MCOMPILER-379/module2/src/main/java/com/natros/mcp/Foo.java create mode 100644 src/it/MCOMPILER-379/pom.xml diff --git a/src/it/MCOMPILER-379/invoker.properties b/src/it/MCOMPILER-379/invoker.properties new file mode 100644 index 00000000..0659ac55 --- /dev/null +++ b/src/it/MCOMPILER-379/invoker.properties @@ -0,0 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +invoker.goals = compile diff --git a/src/it/MCOMPILER-379/module1/pom.xml b/src/it/MCOMPILER-379/module1/pom.xml new file mode 100644 index 00000000..32c43dfb --- /dev/null +++ b/src/it/MCOMPILER-379/module1/pom.xml @@ -0,0 +1,42 @@ + + + + + 4.0.0 + + + org.apache.maven.plugins.compiler.it + mcompiler-379 + 1.0-SNAPSHOT + + + module1 + + + + org.apache.maven.plugins.compiler.it + module2 + ${project.version} + + + diff --git a/src/it/MCOMPILER-379/module2/pom.xml b/src/it/MCOMPILER-379/module2/pom.xml new file mode 100644 index 00000000..5a96f914 --- /dev/null +++ b/src/it/MCOMPILER-379/module2/pom.xml @@ -0,0 +1,36 @@ + + + + + 4.0.0 + + + org.apache.maven.plugins.compiler.it + mcompiler-379 + 1.0-SNAPSHOT + + + module2 + + + 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 new file mode 100644 index 00000000..7e6d55c2 --- /dev/null +++ b/src/it/MCOMPILER-379/module2/src/main/java/com/natros/mcp/Foo.java @@ -0,0 +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 com.natros.mcp; + +public class Foo { +} diff --git a/src/it/MCOMPILER-379/pom.xml b/src/it/MCOMPILER-379/pom.xml new file mode 100644 index 00000000..53eb9b4f --- /dev/null +++ b/src/it/MCOMPILER-379/pom.xml @@ -0,0 +1,54 @@ + + + + + 4.0.0 + + org.apache.maven.plugins.compiler.it + mcompiler-379 + 1.0-SNAPSHOT + pom + + + UTF-8 + + + + module1 + module2 + + + + + + org.apache.maven.plugins + maven-compiler-plugin + @project.version@ + + 7 + 7 + + + + + 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 0ac1e27d..c53fe78f 100644 --- a/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java +++ b/src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java @@ -655,6 +655,11 @@ public void execute() if ( generatedSourcesDirectory != null ) { + if ( !generatedSourcesDirectory.exists() ) + { + generatedSourcesDirectory.mkdirs(); + } + String generatedSourcesPath = generatedSourcesDirectory.getAbsolutePath(); compileSourceRoots.add( generatedSourcesPath ); @@ -1605,7 +1610,7 @@ private boolean hasNewFile( File classPathEntry, Date buildStartTime ) if ( classPathEntry.isFile() ) { return classPathEntry.lastModified() >= buildStartTime.getTime() - && fileExtensions.contains( FileUtils.getExtension( classPathEntry.getName() ) ); + && fileExtensions.contains( FileUtils.getExtension( classPathEntry.getName() ) ); } File[] children = classPathEntry.listFiles();