Stefan Seifert created FELIX-4535:
-------------------------------------
Summary: Calling eclipse:eclipse with maven-scr-plugin r1.15.0 and
up leads to corrupt Eclipse project
Key: FELIX-4535
URL: https://issues.apache.org/jira/browse/FELIX-4535
Project: Felix
Issue Type: Bug
Affects Versions: maven-scr-plugin 1.17.0, maven-scr-plugin 1.16.0,
maven-scr-plugin 1.15.0
Reporter: Stefan Seifert
in r1.15.0 of the eclipse plugin (FELIX-4241) the default output directory of
the generated SCR metadata files was changed to
{{$\{project.build.directory\}/classes}}
this leads to problems when generating and eclipse project with the
maven-eclipse plugin like this - eclipse reports an error like this:
{noformat}
Source folder 'src/main/java' in project 'scr-testproject' cannot output to
distinct source folder
The project cannot be built until build path errors are resolved
{noformat}
to be precise, the error occurs only when the eclipse project is generated at
the same time as the SCR generation, e.g.
{noformat}
mvn clean install eclipse:eclipse
{noformat}
if this is done in two independent steps it does not occur:
{noformat}
mvn clean install
mvn eclipse:eclipse
{noformat}
if the plugin version is downgraded to 1.14.0 it works as usual.
the source of the problem is that when the project is generated at the same
time as in the build, an additional "source" folder is added to the
{{.classpath}} eclipse project file - so it exists twice, once as source folder
and once as target folder:
{code:xml}
<classpathentry kind="src" path="target/classes" excluding="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
{code}
i'm not sure why this is happening. i assume the problem is the method
{{SCRDescriptorMojo.updateProjectResources()}} in the maven-scr-plugin, but i'm
not sure for what it is needed.
please note that this problem was already mentioned in the comments of
FELIX-4241, but the solution from robert is not plausible for me: "The conflict
seems to be with the explicit pluginExecution definition for the
maven-scr-plugin. If I remove that, all works fine.". if the execution
"generate-scr-scrdescriptor" is removed, no SCR metadata is generated at all
for the annotated classes. this removes the eclipse project problem, but the
component are no longer SCR components as well.
attached is a minimal test project to reproduce the problem with the mvn calls
mentioned above.
--
This message was sent by Atlassian JIRA
(v6.2#6252)