Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate source files issue in Intellij #11

Closed
mkotsbak opened this issue Apr 20, 2016 · 5 comments
Closed

Duplicate source files issue in Intellij #11

mkotsbak opened this issue Apr 20, 2016 · 5 comments

Comments

@mkotsbak
Copy link
Contributor

Working with a project that uses this plugin in Intellij causes duplicate source files issue. It seems to be caused by both
[project]/target/scala-2.11/src_managed/main and
[project]/target/scala-2.11/src_managed/main/cxf
being in the managed source directories.

Is there a need to have it inside the cxf directory? Apparently the problem is solved by outcommenting this line:
sourceManaged in CxfConfig := sourceManaged.value / "cxf",

@theBlackDragon
Copy link
Contributor

theBlackDragon commented Apr 20, 2016

This location is what is being suggested by the Sbt documentation, unfortunately Maven Java source generating plugins do this differently, resulting in lots of confusion among people and tools used to work with the default Maven structure, on top of that there seems to be some confusion in the Sbt camp and there are some Sbt plugins that do not adhere to what the documentation prescribes, resulting in this very problem.

I'd be inclined to say the problem is with Sbt adding the "main" subdirectory to "src_managed" and I'd be in favour of getting rid of that (at the Sbt side). I feel that removing the "cxf" subdirectory in the plugin will only lead to problems down the road. Either way, some standard needs to be decided on at Sbt's side and plugins (and IDEs) need to be updated accordingly (see sbt/sbt#1664). As long as the Sbt people don't make up their minds I'd argue that sticking to what's documented is the safest thing to do. (and as a result I'd argue that IDEA adding "main" as a source directory for an Sbt project is wrong based on what is currently in the Sbt documentation).

Also be aware that one of Sbt's developers has pointed out that the directory structure currently used by sbt-cxf-wsdl2java is a good idea (see sbt/sbt-xjc#15 the comment made by @eed3si9n on 9 September 2015)

@mkotsbak
Copy link
Contributor Author

mkotsbak commented Apr 21, 2016

What about doing a workaround until a better solution is found by following this advice:
"A source generation task should generate sources in sourceManaged, or if it wants to keep the source files it generates separate from other source generation tasks, it should generate sources to a sub directory in crossTarget and add that directory to managedSourceDirectories."

That is, add the directory in crossTarget instead of sourceManaged directory.

As it is now, enabling autoimport from sbt in IntelliJ makes it unusable.

@theBlackDragon
Copy link
Contributor

I can confirm that this works around the problem and appears to be working in IDEA at least. It's also unlikely to conflict with whatever is decided on the Sbt side later, which is a nice bonus imho.

I'll see if I can find the time to test this solution with Eclipse.

@mkotsbak
Copy link
Contributor Author

mkotsbak commented Apr 25, 2016

Great. I see no reason it should not work in Eclipse. Also not sure if it breaks in Eclipse as with IntelliJ as it was.

@theBlackDragon
Copy link
Contributor

Neither did I, but it felt safer to check and I can confirm it works in Eclipse as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants