Maven Integration for Eclipse

Resource building and filtering enabled for eclipse

Details

  • Type: New Feature New Feature
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 0.0.11
  • Fix Version/s: 0.9.0
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

At this moment Eclipse or M2Eclipse doesn't have any resource building and filtering like Maven2 does. This means that everything that you configure in the project->build->resources (or test-resources) doesn't get reflected in Eclipse. This creates a great gap between Eclipse and Maven2 IMHO.
For me personally the resource filtering is very important. Here is the reason why: I am working on a EJB3 project. This project has several UnitTests that use the database. Every developer has it's own instance on the database to prevent conflicts when running Unit-Tests (data gets added and deleted by DBUnit). That is why there are profiles that set the database test connection for every developer. The configuration file containing the connection gets read by an external library. I can't influence it, so I can't change the way the file gets read, so I am not able to filter the variables before the configuration is read. I could change the file but that won't work either. The problem is that m2eclipse Plugin configures the Classpath so that the classpath output folder of a resource directory is the same as resource directory itself and not /target/classes or /target/test-classes. I know that there is a good reason for it (explained in MNGECLIPSE-15) but now it causes the problem that when I would rewrite the file I would change the actual source file. That is not anything I really would want.
Before using this Eclipse Plugin I used the standard eclipse command from maven2 to setup my eclipse environment. This configures the classpath resoures output tot the /target/classes or /target/test-classes directory. I then added an extra builder for the project that started the mvn process-resources and process-test-resources when certain files got changed. This workes fine.
Couldn't some solution be implemented that uses the resource configuration of POM to setup the resource directory and does the resource processing like Maven2 does? Or at least and option that the output directories of the resource directories are /target/classes and target/test-classes? This way I could use my own builder solution.

Activity

Hide
Eugene Kuleshov added a comment -

You can still add maven builder for this project. There are several reasons to not add it automatically.

Show
Eugene Kuleshov added a comment - You can still add maven builder for this project. There are several reasons to not add it automatically.
Hide
Lukasz Dywicki added a comment -

I also vote for this ticket. Currently i've big problem because my project use maven filtering in web.xml and other webapp files. That files aren't included in java build path and i can't use publish features from WTP.

Show
Lukasz Dywicki added a comment - I also vote for this ticket. Currently i've big problem because my project use maven filtering in web.xml and other webapp files. That files aren't included in java build path and i can't use publish features from WTP.
Hide
Eugene Kuleshov added a comment -

Lukasz, actually you can. Go to project properties / builders / add / maven builder

Show
Eugene Kuleshov added a comment - Lukasz, actually you can. Go to project properties / builders / add / maven builder
Hide
Kyle Lebel added a comment -

Eugine, I'd be interested in hearing the reasons why this should not be included in the m2eclipse plugin? I'm currently using the maven builder approach as a workaround, but I find this to be very clunky as it is triggered every file save, and have yet to find a better approach.

Thanks,

Show
Kyle Lebel added a comment - Eugine, I'd be interested in hearing the reasons why this should not be included in the m2eclipse plugin? I'm currently using the maven builder approach as a workaround, but I find this to be very clunky as it is triggered every file save, and have yet to find a better approach. Thanks,
Hide
Eugene Kuleshov added a comment -

It been a while since I said that and since then we found some solutions for this. Though when resource filtering is enables, the chances are that build still be kicked when any file from resource folder is changed (as well as when some other files are changed).

Show
Eugene Kuleshov added a comment - It been a while since I said that and since then we found some solutions for this. Though when resource filtering is enables, the chances are that build still be kicked when any file from resource folder is changed (as well as when some other files are changed).
Hide
Kyle Lebel added a comment -

Ah excellent, I'm anxious to hear what ideas you've found on this. I'm also watching the maven-eclipse-plugin (http://jira.codehaus.org/browse/MECLIPSE-165), which seems to be a similar issue.

Thanks for the quick reply.

Show
Kyle Lebel added a comment - Ah excellent, I'm anxious to hear what ideas you've found on this. I'm also watching the maven-eclipse-plugin (http://jira.codehaus.org/browse/MECLIPSE-165), which seems to be a similar issue. Thanks for the quick reply.
Hide
Kyle Lebel added a comment -

Not sure if this is related, or that I should perhaps create a new defect. But I've also noticed, with multi-module projects, maven-resources-plugin processes the resources and outputs them to the nested module's ./target/classes. However for eclipse to see this on it's classpath, these filtered resources must exist on the main ./target/classes where it's build output is. For now, i'm able to work around this by providing this configuration in the root / super-pom:

<configuration>
<!--
This configuration is required, for some reason maven-resources-plugin /
m2eclipse does not make these available to eclipse classpath without this
-->
<outputDirectory>./target/classes</outputDirectory>
</configuration>

Let me know what you think, thanks,

Show
Kyle Lebel added a comment - Not sure if this is related, or that I should perhaps create a new defect. But I've also noticed, with multi-module projects, maven-resources-plugin processes the resources and outputs them to the nested module's ./target/classes. However for eclipse to see this on it's classpath, these filtered resources must exist on the main ./target/classes where it's build output is. For now, i'm able to work around this by providing this configuration in the root / super-pom: <configuration> <!-- This configuration is required, for some reason maven-resources-plugin / m2eclipse does not make these available to eclipse classpath without this --> <outputDirectory>./target/classes</outputDirectory> </configuration> Let me know what you think, thanks,
Hide
Eugene Kuleshov added a comment -

(In reply to comment #7)
Kyle, no that one is not related and more sound like MNGECLIPSE-457
I also would like to keep bug reports focused on a single issue, so I may have to clean some comments on this one to keep it clear.

Show
Eugene Kuleshov added a comment - (In reply to comment #7) Kyle, no that one is not related and more sound like MNGECLIPSE-457 I also would like to keep bug reports focused on a single issue, so I may have to clean some comments on this one to keep it clear.
Hide
Eugene Kuleshov added a comment -

This feature been available since 0.9.0 build and since 0.9.1 build you can enable it from Maven page in project preferences dialog.

Show
Eugene Kuleshov added a comment - This feature been available since 0.9.0 build and since 0.9.1 build you can enable it from Maven page in project preferences dialog.

People

Vote (1)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: