Good idea! This is one of the things that I was hoping would get addressed =)

I'm new to the list so I'm not sure if this has been covered, but has there been any thoughts to supporting multiple source entries so that when one runs eclipse:generate-project it will properly set up the src's in the .classpath. I really have no preference of setting the source folders through properties or in the project.xml.

It would also be nice to specify the eclipse output entry in the .classpath (path=bin) separate from maven's build path "target/classes*.

Thanks

-Mark

At 06:40 PM 3/28/2003 +0000, you wrote:
I've just done a little hacking on the eclipse plugin. I wanted to be
able to specify that a dependency between two maven projects should
result in a project and classpath reference in the Eclipse project,
rather than an entry for a jar file. This should make things a bit more
natural when working with a number of related projects under Eclipse -
it removes the need to build jar files and install them in the maven
repository outside of Eclipse.

As I said, this is a preliminary hack - I think this is something that
needs addressing, but I'm not sure whether this is the best way to do
it. Comments welcome.

What I've done is allow a dependency to be marked as requiring an
eclipse dependency:

>     <dependency>
>       <id>werkflow</id>
>       <version>1.0-beta-4</version>
>       <url>http://werkflow.werken.com/</url>
>       <properties>
>         <eclipse.dependency>true</eclipse.dependency>
>       </properties>
>     </dependency>

If you mark a dependency like this the plugin will assume that you have
the source of the dependent project open in the same workspace as the
project you're creating a .project and .classpath file for. Instead of
putting a jar reference into the classpath it will create a reference to
the project itself.

I thought about using the SNAPSHOT version to indicate things that are
local, but snapshot dependencies don't necessarily indicate that you
have the project open locally.

I'm not sure whether this should really go into project.xml - whether a
given developer has something open in Eclipse is possibly not something
that should be in CVS, for example. On the other hand, such a
declaration indicates that a dependency could be even more volatile than
a snapshot dependency, which might be useful information to have in
project.xml. I'm 50:50 over where this should go.

As I said, comments welcome. I'll update the patch based on feedback,
document it and send a new patch if things seem ok.

-Mark.


Index: src/plugins-build/eclipse/plugin.jelly
===================================================================
RCS file: /home/cvspublic/maven/src/plugins-build/eclipse/plugin.jelly,v
retrieving revision 1.9
diff -u -r1.9 plugin.jelly
--- src/plugins-build/eclipse/plugin.jelly 27 Mar 2003 13:16:40 -0000 1.9
+++ src/plugins-build/eclipse/plugin.jelly 28 Mar 2003 18:08:13 -0000
@@ -19,7 +19,7 @@


     <j:set var="outputDir" value="${maven.eclipse.output.dir}"/>
     <j:if test="${empty outputDir}">
-      <j:set var="outputDir" value="target\classes"/>
+      <j:set var="outputDir" value="target/classes"/>
     </j:if>

     <ant:echo>Creating ${basedir}/.project ...</ant:echo>
@@ -29,6 +29,13 @@
   <name>${pom.artifactId}</name>
   <comment></comment>
   <projects>
+      <j:forEach var="lib" items="${pom.artifacts}">
+       <j:set var="eclipseDependency"
+              value="${lib.dependency.getProperty('eclipse.dependency')}"/>
+       <j:if test="${eclipseDependency == 'true'}">
+    <project>${lib.dependency.artifactId}</project>
+       </j:if>
+      </j:forEach>
   </projects>
   <buildSpec>
     <buildCommand>
@@ -83,7 +90,16 @@

<classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
<j:forEach var="lib" items="${pom.artifacts}">
- <classpathentry kind="var" path="MAVEN_REPO${lib.urlPath}"/>
+ <j:set var="eclipseDependency"
+ value="${lib.dependency.getProperty('eclipse.dependency')}"/>
+ <j:choose>
+ <j:when test="${eclipseDependency == 'true'}">
+ <classpathentry kind="src" path="/${lib.dependency.artifactId}"/>
+ </j:when>
+ <j:otherwise>
+ <classpathentry kind="var" path="MAVEN_REPO${lib.urlPath}"/>
+ </j:otherwise>
+ </j:choose>
</j:forEach>
<classpathentry kind="output" path="${outputDir}"/>
</classpath>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Reply via email to