Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349586 - Extra source folders added by build-helper-plugin are not made available to plugins
Summary: Extra source folders added by build-helper-plugin are not made available to p...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: m2e (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Igor Fedorenko CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 352494 357873 (view as bug list)
Depends on: 359158
Blocks:
  Show dependency tree
 
Reported: 2011-06-16 11:34 EDT by Vincent Vandenschrick CLA
Modified: 2021-04-19 13:24 EDT (History)
7 users (show)

See Also:


Attachments
Standalone testcase project (3.70 KB, application/octet-stream)
2011-06-16 11:36 EDT, Vincent Vandenschrick CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vincent Vandenschrick CLA 2011-06-16 11:34:40 EDT
Build Identifier: 20110301-1815

Extra source folders added by the build-helper plugin are correctly added as Eclipse project source folder during project (re)configuration but are not made available to other plugins during the Eclipse build (it is with Maven CLI).

One example of such mis-behaviour is that the XDoclet2 plugin cannot process sources that are located in such added source directories.

A sample standalone Eclipse project is attached to demonstrate this problem :
TestEntity.java in src/main/java is correctly processed
while TestEntityBad.java in src/other-sources (added by build-helper) is not.

Note that both classes are correctly compiled by Eclipse in target/classes.

Reproducible: Always
Comment 1 Vincent Vandenschrick CLA 2011-06-16 11:36:02 EDT
Created attachment 198120 [details]
Standalone testcase project
Comment 2 Igor Fedorenko CLA 2011-08-03 04:50:29 EDT
There are at least two related problems here

First, m2e maintain MavenProject state during project import, configuration update and workspace build the same way as during command line build. In case of build-helper-maven-plugin:add-sources this means adding compile source roots to the model, but other configurators will need to provide similar functionality.

Second, we need to make sure MavenProject state either survives workbench restart or is properly recreated after workbench restart. Currently, new project instance is read after restart and project configurators do not get the chance to make any changes to the project instance.
Comment 3 Igor Fedorenko CLA 2011-09-22 11:40:37 EDT
*** Bug 357873 has been marked as a duplicate of this bug. ***
Comment 4 Igor Fedorenko CLA 2011-09-22 22:04:16 EDT
*** Bug 352494 has been marked as a duplicate of this bug. ***
Comment 6 Igor Fedorenko CLA 2011-09-29 00:33:26 EDT
This should be fixed now. Fix will be included in m2e 1.1 M3 build, but current snapshot version can be installed from https://repository.sonatype.org/content/repositories/forge-sites/m2e/1.1.0/N/LATEST/

Two major changes were required to properly support propagation of MavenProject instance changes from one mojo execution to the next.

To make sure changes to the MavenProject instance are taken into account during project import and/or configuration update, m2e executes all compatible mojo executions before execution of project configurators #configure methods. Compatible mojo executions are marked with <runOnConfiguration>true</runOnConfiguration> <execute/> mapping subelement. By default runOnConfiguration is false. For example,

      <action>
        <execute>
          <runOnConfiguration>true</runOnConfiguration>
          <runOnIncremental>true</runOnIncremental>
        </execute>
      </action>

Mutable MavenProject instance state (i.e. sources, resources and properties) is reset after each build. This is allows reuse of the same MavenProject instance, otherwise pom.xml will need to be reparsed during each workspace build, which would likely result in significant performance degradation compared to m2e 1.0.
Comment 7 Matthew Lieder CLA 2011-09-30 12:19:14 EDT
Igor, have you tested your fix against the testcase in bug 352494? I just updated my Eclipse to the snapshot you linked to but still am experiencing the same problem.
Comment 8 Igor Fedorenko CLA 2011-09-30 13:14:28 EDT
(In reply to comment #7)
> Igor, have you tested your fix against the testcase in bug 352494? I just
> updated my Eclipse to the snapshot you linked to but still am experiencing the
> same problem.

yes, it works. kinda. see attached project and my comment in bug 352494.
Comment 9 Denis Roy CLA 2021-04-19 13:24:17 EDT
Moved to https://github.com/eclipse-m2e/m2e-core/issues/