History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-31529
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Normal Normal
Assignee: Anton Makeev
Reporter: Erik Husby
Votes: 5
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

Directories under target/generated-sources incorrectly added to source paths

Created: 15 Aug 08 18:36   Updated: 10 Nov 08 12:37
Component/s: Maven Integration
Fix Version/s: Diana 8.0.1

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Environment: Mac OS X 10.5.4, Java 1.5
Issue Links:
Duplicate
 
This issue is duplicated by:
IDEA-20065 Running a unit test with the "Make" o... Closed

Build: 7,938
Fixed in build: 9,018
Severity: High


 Description  « Hide
Our projects can generate sources from multiple sources and for multiple reasons. So our target/generated-sources will have multiple sub-directories. Intellij adds these directories without regard to the correct package structure. And if one has auto import turned on a for a Maven based project, the paths are always updated even if one has manually corrected them.

One example is using the GMaven groovy based plugin. This plugin generates Java stubs for Groovy sources. The Java stubs end up in one of two directories, target/generated-sources/groovy-stubs/main or target/generated-sources/groovy-stubs/test.

There are two side effects of adding the paths incorrectly.

1. Because the paths do not match the package structure, Intellij will constantly recompile them.
2. And when the test directory ends up in the main src path, one can get compilation errors.



 All   Comments   Work Log   Change History      Sort Order:
Paul Smith - 04 Sep 08 20:21
I have a similar but different problem. I'm generating source under target/generated-source but Intellij is picking up the source path as including the first part of the package.

So I'm generating 'target/generated-source/com/foo/bar/MyClass.java' and Intellij is adding 'target/generated-source/com' as the source path. This obviously then fails to compile as the package name doesn't match the directory.

I can temporarily fix the issue by changing the source path in my project settings, but this get's reverted back to the above broken path everytime Intellij re-syncs with Maven.

Paul


Keith GAnger - 26 Sep 08 21:14
I also have a similar issue.

I am using 8.0 M1

The maven importer is constantly adding the target/generated-source to my Source Folders.
I also have src/main/groovy as a source folder. Therefore when I build with with maven the .java sources are generated and added as source.
I then get Errors with my groovy sources saying that the class name already exists.

It would be ideal to be able to tell the maven importer to not use the generated-sources directory at all.


Anton Makeev - 21 Oct 08 16:30
Paul,

The general contract for the 'generated-sources' folder is that it contains sub-folders for each plugin; IDEA looks into each sub-folder and adds its content as 'source folder'.

Therefore, if you want IDEA to correctly configure your generated sources, please edit your scripts so that sources are placed under 'generated-sources/<some-folder>' directory.

Thanks,
Anton Makeev.


Anton Makeev - 21 Oct 08 16:32
If IDEA discovers the groovy plugin attached to the pom, it won't add 'generated-sources/groovy-stubs/...' as source folders.

Anton Makeev - 22 Oct 08 16:45
The fix will be available right after 8.0 since it requires some critical rework.

Danny Siu - 10 Nov 08 09:16
Is there any work around for this problem?