Maven 1.x Eclipse Plugin
  1. Maven 1.x Eclipse Plugin
  2. MPECLIPSE-71

Better support for multiproject with eclipse plugin

    Details

    • Type: New Feature New Feature
    • Status: Closed Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Number of attachments :
      3

      Description

      Currently when eclipse generates .classpath file, the subprojects' target paths default to the parent project's target path.

      for example if you have a POM A which is a parent project, and POM B and C that are subprojects of A, generated classpath will have :

      src/java -> target/classes
      src/test -> target/test-classes
      B/src/java -> target/classes
      B/src/test -> target/test-classes
      C/src/java -> target/classes
      C/src/test -> target/test-classes

      If I get a chance, I'll post a patch.

        Activity

        Hide
        Yujin Kim added a comment -

        Actually I take back what I said. Currently maven-eclipse plugin doesn't support multiproject period. I forgot I had to write my own jelly tag to make it work in our multiproject environment.

        I think I do have a solution for this and will post a patch (will need to modify classpath.jelly) for this whenever I can.

        • yujin
        Show
        Yujin Kim added a comment - Actually I take back what I said. Currently maven-eclipse plugin doesn't support multiproject period. I forgot I had to write my own jelly tag to make it work in our multiproject environment. I think I do have a solution for this and will post a patch (will need to modify classpath.jelly) for this whenever I can. yujin
        Hide
        Yujin Kim added a comment -

        patch for allowing multiproject .classpath generation.
        i tried avoid making risks and pretty much copied the code that handles the single project classpath and put that into a loop using reactor.

        limitation: if the sub project is not under the current root, this probably won't work, ie if root project A and child project B are at the same level, instead of B residing under A, this will most likely fail.

        also i didn't put too much effort into parsing the exclude filter for reactor. just checking if it's empty then add the root project. I think eventually the part that handles the single project and the code i added can be merged.

        Show
        Yujin Kim added a comment - patch for allowing multiproject .classpath generation. i tried avoid making risks and pretty much copied the code that handles the single project classpath and put that into a loop using reactor. limitation: if the sub project is not under the current root, this probably won't work, ie if root project A and child project B are at the same level, instead of B residing under A, this will most likely fail. also i didn't put too much effort into parsing the exclude filter for reactor. just checking if it's empty then add the root project. I think eventually the part that handles the single project and the code i added can be merged.
        Hide
        Yujin Kim added a comment -

        adding a test project i used to test the plugin patch.

        Show
        Yujin Kim added a comment - adding a test project i used to test the plugin patch.
        Hide
        Yujin Kim added a comment -

        uploading the patch for svn. (previous patch was based on cvs)

        Show
        Yujin Kim added a comment - uploading the patch for svn. (previous patch was based on cvs)
        Hide
        Yujin Kim added a comment -

        use classpath.jelly.MPECLIPSE-71.zip for SVN.
        also addd one propject properties but wasn't sure where it needs to be patched.

        maven.multiproject.eclipse.includes: if not set, falls back to maven.multproject.includes, or "*/project.xml" if it's not set either
        maven.multiproject.eclipse.excludes: to exclude subprojcet from being included in the eclipse classpath. (such as sandbox projects).

        One issue I know still exists is when you have multiproject stucture for webapps. The way this is done, you can't have a subproject level dependency. Because eclipse doesn't support multi-tier project, for eclipse project to be able to see the dependencies is to have the dependencies declared at the top level project.

        Show
        Yujin Kim added a comment - use classpath.jelly. MPECLIPSE-71 .zip for SVN. also addd one propject properties but wasn't sure where it needs to be patched. maven.multiproject.eclipse.includes: if not set, falls back to maven.multproject.includes, or "*/project.xml" if it's not set either maven.multiproject.eclipse.excludes: to exclude subprojcet from being included in the eclipse classpath. (such as sandbox projects). One issue I know still exists is when you have multiproject stucture for webapps. The way this is done, you can't have a subproject level dependency. Because eclipse doesn't support multi-tier project, for eclipse project to be able to see the dependencies is to have the dependencies declared at the top level project.
        Hide
        Scott Lamb added a comment -

        There's another patch at http://issues.apache.org/jira/browse/AGILA-13 which I had some success with.

        Show
        Scott Lamb added a comment - There's another patch at http://issues.apache.org/jira/browse/AGILA-13 which I had some success with.
        Hide
        Yujin Kim added a comment -

        Since i uploaded the patch, I also added eclipse project depdency handling, so inside eclipse, i can let eclipse build multiple "eclipse" projects without having to rely on maven, while continuous build, etc can still use maven to build it.

        i'll submit a patch if/when the above patch(or the one in agila) makes it to the main tree.

        Show
        Yujin Kim added a comment - Since i uploaded the patch, I also added eclipse project depdency handling, so inside eclipse, i can let eclipse build multiple "eclipse" projects without having to rely on maven, while continuous build, etc can still use maven to build it. i'll submit a patch if/when the above patch(or the one in agila) makes it to the main tree.
        Hide
        Max Rudman added a comment -

        I had the same need and created my own version. Submitted patch is actually more robust than what I did so I am not submitting mine. However, I have a couple of suggestions:

        1) Generated sources dir for nested projects should be obtained with something like this:

        <j:set var="nestedContext" value="$

        {reactorProject.context}

        "/>
        <j:invoke var="genSrc" on="$

        {nestedContext}

        " method="getVariable">
        <j:arg value="maven.gen.src"/>
        </j:invoke>

        This way nested project's potentially different setting is respected. Same should be done for maven.build.dir

        2) I put multiproject handling into a separate "multiclasspath.jelly" file and included it in the main classpath.jelly. I like smaller files as I feel they are easier to work with/find things in.

        Show
        Max Rudman added a comment - I had the same need and created my own version. Submitted patch is actually more robust than what I did so I am not submitting mine. However, I have a couple of suggestions: 1) Generated sources dir for nested projects should be obtained with something like this: <j:set var="nestedContext" value="$ {reactorProject.context} "/> <j:invoke var="genSrc" on="$ {nestedContext} " method="getVariable"> <j:arg value="maven.gen.src"/> </j:invoke> This way nested project's potentially different setting is respected. Same should be done for maven.build.dir 2) I put multiproject handling into a separate "multiclasspath.jelly" file and included it in the main classpath.jelly. I like smaller files as I feel they are easier to work with/find things in.
        Hide
        Michael Osipov added a comment -

        Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

        Show
        Michael Osipov added a comment - Please refer to https://cwiki.apache.org/confluence/display/MAVEN/The+Great+JIRA+Cleanup+of+2014 if you're wondering why this issue was closed out.

          People

          • Assignee:
            Unassigned
            Reporter:
            Yujin Kim
          • Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: