Skip to content

Commit 6fd3a46

Browse files
committed
[MCOMPILER-379] - Fatal error compiling: basedir ... arget/generated-sources/annotations does not exist
- Created Integration test which currently fails.
1 parent a5c6bc5 commit 6fd3a46

File tree

6 files changed

+178
-1
lines changed

6 files changed

+178
-1
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
invoker.goals = compile

src/it/MCOMPILER-379/module1/pom.xml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing,
14+
~ software distributed under the License is distributed on an
15+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
~ KIND, either express or implied. See the License for the
17+
~ specific language governing permissions and limitations
18+
~ under the License.
19+
-->
20+
21+
<project
22+
xmlns="http://maven.apache.org/POM/4.0.0"
23+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
25+
<modelVersion>4.0.0</modelVersion>
26+
27+
<parent>
28+
<groupId>org.apache.maven.plugins.compiler.it</groupId>
29+
<artifactId>mcompiler-379</artifactId>
30+
<version>1.0-SNAPSHOT</version>
31+
</parent>
32+
33+
<artifactId>module1</artifactId>
34+
35+
<dependencies>
36+
<dependency>
37+
<groupId>org.apache.maven.plugins.compiler.it</groupId>
38+
<artifactId>module2</artifactId>
39+
<version>${project.version}</version>
40+
</dependency>
41+
</dependencies>
42+
</project>

src/it/MCOMPILER-379/module2/pom.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing,
14+
~ software distributed under the License is distributed on an
15+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
~ KIND, either express or implied. See the License for the
17+
~ specific language governing permissions and limitations
18+
~ under the License.
19+
-->
20+
21+
<project
22+
xmlns="http://maven.apache.org/POM/4.0.0"
23+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
25+
<modelVersion>4.0.0</modelVersion>
26+
27+
<parent>
28+
<groupId>org.apache.maven.plugins.compiler.it</groupId>
29+
<artifactId>mcompiler-379</artifactId>
30+
<version>1.0-SNAPSHOT</version>
31+
</parent>
32+
33+
<artifactId>module2</artifactId>
34+
35+
36+
</project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
package com.natros.mcp;
20+
21+
public class Foo {
22+
}

src/it/MCOMPILER-379/pom.xml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one
4+
~ or more contributor license agreements. See the NOTICE file
5+
~ distributed with this work for additional information
6+
~ regarding copyright ownership. The ASF licenses this file
7+
~ to you under the Apache License, Version 2.0 (the
8+
~ "License"); you may not use this file except in compliance
9+
~ with the License. You may obtain a copy of the License at
10+
~
11+
~ http://www.apache.org/licenses/LICENSE-2.0
12+
~
13+
~ Unless required by applicable law or agreed to in writing,
14+
~ software distributed under the License is distributed on an
15+
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
~ KIND, either express or implied. See the License for the
17+
~ specific language governing permissions and limitations
18+
~ under the License.
19+
-->
20+
21+
<project
22+
xmlns="http://maven.apache.org/POM/4.0.0"
23+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
25+
<modelVersion>4.0.0</modelVersion>
26+
27+
<groupId>org.apache.maven.plugins.compiler.it</groupId>
28+
<artifactId>mcompiler-379</artifactId>
29+
<version>1.0-SNAPSHOT</version>
30+
<packaging>pom</packaging>
31+
32+
<properties>
33+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
34+
</properties>
35+
36+
<modules>
37+
<module>module1</module>
38+
<module>module2</module>
39+
</modules>
40+
41+
<build>
42+
<plugins>
43+
<plugin>
44+
<groupId>org.apache.maven.plugins</groupId>
45+
<artifactId>maven-compiler-plugin</artifactId>
46+
<version>@project.version@</version>
47+
<configuration>
48+
<source>7</source>
49+
<target>7</target>
50+
</configuration>
51+
</plugin>
52+
</plugins>
53+
</build>
54+
</project>

src/main/java/org/apache/maven/plugin/compiler/AbstractCompilerMojo.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,11 @@ public void execute()
655655

656656
if ( generatedSourcesDirectory != null )
657657
{
658+
if ( !generatedSourcesDirectory.exists() )
659+
{
660+
generatedSourcesDirectory.mkdirs();
661+
}
662+
658663
String generatedSourcesPath = generatedSourcesDirectory.getAbsolutePath();
659664

660665
compileSourceRoots.add( generatedSourcesPath );
@@ -1605,7 +1610,7 @@ private boolean hasNewFile( File classPathEntry, Date buildStartTime )
16051610
if ( classPathEntry.isFile() )
16061611
{
16071612
return classPathEntry.lastModified() >= buildStartTime.getTime()
1608-
&& fileExtensions.contains( FileUtils.getExtension( classPathEntry.getName() ) );
1613+
&& fileExtensions.contains( FileUtils.getExtension( classPathEntry.getName() ) );
16091614
}
16101615

16111616
File[] children = classPathEntry.listFiles();

0 commit comments

Comments
 (0)