Issue Details (XML | Word | Printable)

Key: MNGECLIPSE-343
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Unassigned
Reporter: Maurice Zeijen
Votes: 1
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Maven Integration for Eclipse

Resource building and filtering enabled for eclipse

Created: 01/Jun/07 07:32 AM   Updated: 11/Apr/08 12:10 AM   Resolved: 11/Apr/08 12:10 AM
Return to search
Component/s: None
Affects Version/s: 0.0.11
Fix Version/s: 0.9.0

Time Tracking:
Not Specified


 Description  « Hide

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.



Eugene Kuleshov added a comment - 01/Jun/07 09:51 AM

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


Lukasz Dywicki added a comment - 12/Jul/07 05:06 AM

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.


Eugene Kuleshov added a comment - 12/Jul/07 07:43 AM

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


Kyle Lebel added a comment - 08/Jan/08 10:36 PM

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,


Eugene Kuleshov added a comment - 08/Jan/08 10:46 PM

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).


Kyle Lebel added a comment - 08/Jan/08 10:58 PM

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.


Kyle Lebel added a comment - 09/Jan/08 10:45 AM

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,


Eugene Kuleshov added a comment - 09/Jan/08 11:31 AM

(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.


Eugene Kuleshov added a comment - 11/Apr/08 12:10 AM

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.