Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: 0.0.10
-
Fix Version/s: None
-
Component/s: Project Configuration
-
Labels:None
Description
When you perform an "update source folders", the plugin adds all your resource folders as source folders. It then does a wierd thing: adding exclusions to the folders so that nothing is copied (this is really bad, because it gets in the way of runtime resource resolution).
What it should do is what I do manually, add resource folders as Eclipse Class Folders, which are added to the runtime class path (but do no have resources copied to the output folder). This is also very close to what Maven does with resource folders at runtime.
-
- mngeclipse378-sample.diff
- 16/Apr/08 6:54 PM
- 0.8 kB
- Christian Gruber
-
Hide
- mngeclipse378-sample.zip
- 16/Apr/08 6:39 PM
- 7 kB
- Christian Gruber
-
- mngeclipse378-sample/pom.xml 0.7 kB
- __MACOSX/mngeclipse378-sample/._pom.xml 0.2 kB
- mngeclipse378-sample/src/main/.../bug/A.java 0.3 kB
- mngeclipse378-sample/.../config.properties 0.0 kB
- mngeclipse378-sample/src/.../apt/index.apt 0.6 kB
- mngeclipse378-sample/src/site/site.xml 0.5 kB
- mngeclipse378-sample/src/.../bugs/ATest.java 0.3 kB
- mngeclipse378-sample/.../logging.properties 0.0 kB
-
Hide
- mngeclipse378-samples-and-diff.zip
- 16/Apr/08 6:53 PM
- 28 kB
- Christian Gruber
-
- mngeclipse378-sample-2/.classpath 0.7 kB
- mngeclipse378-sample-2/.project 0.5 kB
- mngeclipse378-sample-2/.../org.maven.ide.eclipse.prefs 0.2 kB
- mngeclipse378-sample-2/pom.xml 0.7 kB
- __MACOSX/.../._pom.xml 0.2 kB
- mngeclipse378-sample-2/src/.../bug/A.java 0.3 kB
- mngeclipse378-sample-2/.../config.properties 0.0 kB
- mngeclipse378-sample-2/src/.../apt/index.apt 0.6 kB
- mngeclipse378-sample-2/src/site/site.xml 0.5 kB
- mngeclipse378-sample-2/src/.../ATest.java 0.3 kB
- mngeclipse378-sample-2/.../logging.properties 0.0 kB
- mngeclipse378-sample-2/.../config.properties 0.0 kB
- mngeclipse378-sample-2/.../A.class 0.9 kB
- mngeclipse378-sample-2/.../ATest.class 0.6 kB
- mngeclipse378-sample-3/.classpath 0.7 kB
- mngeclipse378-sample-3/.DS_Store 6 kB
- __MACOSX/.../._.DS_Store 0.1 kB
- mngeclipse378-sample-3/.project 0.5 kB
- mngeclipse378-sample-3/.../org.maven.ide.eclipse.prefs 0.2 kB
- mngeclipse378-sample-3/pom.xml 0.7 kB
- __MACOSX/.../._pom.xml 0.2 kB
- mngeclipse378-sample-3/src/.../bug/A.java 0.3 kB
- mngeclipse378-sample-3/.../config.properties 0.0 kB
- mngeclipse378-sample-3/src/.../apt/index.apt 0.6 kB
- mngeclipse378-sample-3/src/site/site.xml 0.5 kB
- mngeclipse378-sample-3/src/.../ATest.java 0.3 kB
- mngeclipse378-sample-3/.../logging.properties 0.0 kB
- mngeclipse378-sample-3/.../config.properties 0.0 kB
- mngeclipse378-sample-3/.../A.class 0.9 kB
- mngeclipse378-sample-3/.../ATest.class 0.6 kB
Issue Links
- duplicates
-
MNGECLIPSE-616
better out of the box experience
-
Activity
For a large example, the Tapestry 5 source (available via SVN) demonstrates what I'd like, and uses class folders, not source folders, for resources. Of course, I have to manually maintain it.
I'll try and find time to do a smaller example.
Open Resources works fine with resources in class folders; I do this all the time.
Thanks Howard. A small example would be very useful. It would be also great if you'd add some code that access these resources (i.e. unit test that we could run from eclipse and with maven cli).
Howard, any change you could make a smaller example for this? Or maybe you can at least point me at the exact location of your projects.
Here's a simple project that illustrates the issue. Just try to import it into eclipse, and /src/test/resources and /src/main/resources are entered into the classpath as source folders, when they aren't (in the sense that eclipse means it). They're resource folders, which eclipse should process as "class folders" since they need to be on the classpath, but not part of the sources.
I'll post a two more files - one that's the project as the eclipse plugin currently generates, and the same project as I want to see it (and I suspect howard does too.)
And here's a zip with 2 projects, one imported with the current plugin, and one altered to the state it should be. Finally, there's a diff on the .classpath files. It's very simple, ultimately, the desired change. I'm also pasting the diff here:
------------------
— mngeclipse378-sample-2/.classpath 2008-04-16 19:43:49.000000000 -0400
+++ mngeclipse378-sample-3/.classpath 2008-04-16 19:48:28.000000000 -0400
@@ -6,9 +6,9 @@
<attribute name="maven.type" value="test"/>
</attributes>
</classpathentry>
- <classpathentry excluding="**" kind="src" output="src/main/resources" path="src/main/resources"/>
- <classpathentry excluding="**" kind="src" output="src/test/resources" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="lib" path="src/main/resources"/>
+ <classpathentry kind="lib" path="src/test/resources"/>
<classpathentry kind="output" path="target-eclipse/classes"/>
</classpath>
------------------------
- <classpathentry excluding="**" kind="src" output="src/main/resources" path="src/main/resources"/>
- <classpathentry excluding="**" kind="src" output="src/test/resources" path="src/test/resources"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> + <classpathentry kind="lib" path="src/main/resources"/> + <classpathentry kind="lib" path="src/test/resources"/> <classpathentry kind="output" path="target-eclipse/classes"/> </classpath> ------------------------
ok that paste didn't work, as jira formatted the stuff. I'm attaching the raw diff file for easy linking.
Christian has add some examples and a diff between the .classpath files from the current source folder approach vs. the resources-as-lib approach – thanks for picking up my slack, Christian!
Christian, thanks for the projects, but what is the actual problem you have with current configuration? What is exactly that does not work for you? Please also indicate if you are using latest 0.9.x m2eclipse build.
I am, and the problem is that you can put .java files in to /src/*/resource folders and maven will not compile them (expected behaviour) but eclipse will (unexpected behaviour) . So it basically means that the meaning of these folders is subtly different, which can cause error. One of the goals should be to make preventable errors prevented categorically.
For me, however, it amounts to an annoying thing I need to do each time I import a project. I now use maven for all my projects I no longer version eclipse configuration files (except in very very odd cases like FlexBuilder projects). Because of this, all the metadata is in pom.xml files, and so "opening" a project is actually an import with m2eclipse. So basically I end up with a 3 step import. 1. Import the maven project. 2. remove the /src//resource folders from the build path. 3. add src//resource folders as class folder libraries. Not gonna kill me, but annoying. And since I contend that the semantic of the current configuration is incorrect, I can't see a good reason not to do this.
We still haven't seen any specifics on why you need X in .classpath and not Y. It seems like you don't like Y, but I really would like to know why.
Anyways, we are improving project configuration as per MNGECLIPSE-616. So, if you have additional comments, please comment there. Thanks.
Howard, do you mind to create sample project that would allow to reproduce issue you are troubled with. Thanks.
I've been thinking to add resources ass class folders, but then there is a concern that they won't be visible trough "Open Resource" dialog.