Maven 1
  1. Maven 1
  2. MAVEN-1270

multiproject:clean fails due to dependencies in reactor set

    Details

    • Type: Improvement Improvement
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 1.0-rc2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      RedHat 9.0. Sun JDK 1.4.2_01, Maven 1.0-rc2
    • Number of attachments :
      0

      Description

      I appologize if this is already entered, but I was unable to find it searching JIRA. This is the same as or similar to #MAVEN-443 which was marked as can't reproduce.

      If you have a multiproject build, you can't execute clean until all artifacts in that build that depend on other artifacts in the build have been produced.

      The ideal behaviour of multiproject:clean would be to either ignore dependencies not needed for the clean task itself, or consider a dependency satisfied if it is in the reactor set.

      The case where this feature would be a particular benefit is when you have an existing source tree, which has been built, and a new component is added. If you do an update and pulling down the new component it has yet to be compiled. You then can't do multiproject:clean on your existing tree because the new dependencies to the new component can't be resolved.

        Activity

        Hide
        Emmanuel Venisse added a comment -

        I think the problem is :
        This problem is due to a bad directory structure.

        You merged the build process and the project definition in the same structure.
        root

        --project.xml (run multiproject from here)
        --subproject1
          --project.xml (extend on project.xml in parent directory)
        --subproject2
          --project.xml (extend on project.xml in parent directory)

        Is it correct or similar?

        The best way is :
        root

        --project.xml (run multiproject from here, you don't need deps))
        --master
          --project.xml (extend on project.xml in master directory)
        --subproject1
          --project.xml (extend on project.xml in master directory)
        --subproject2
          --project.xml (extend on project.xml in parent directory)

        Emmanuel

        Show
        Emmanuel Venisse added a comment - I think the problem is : This problem is due to a bad directory structure. You merged the build process and the project definition in the same structure. root --project.xml (run multiproject from here) --subproject1   --project.xml (extend on project.xml in parent directory) --subproject2   --project.xml (extend on project.xml in parent directory) Is it correct or similar? The best way is : root --project.xml (run multiproject from here, you don't need deps)) --master   --project.xml (extend on project.xml in master directory) --subproject1   --project.xml (extend on project.xml in master directory) --subproject2   --project.xml (extend on project.xml in parent directory) Emmanuel
        Hide
        Emmanuel Venisse added a comment -

        Oups sorry.

        The best way is :
        root

        --project.xml (run multiproject from here, you don't need deps))
        --master
          --project.xml
        --subproject1
          --project.xml (extend on project.xml in master directory)
        --subproject2
          --project.xml (extend on project.xml in master directory)

        Emmanuel

        Show
        Emmanuel Venisse added a comment - Oups sorry. The best way is : root --project.xml (run multiproject from here, you don't need deps)) --master   --project.xml --subproject1   --project.xml (extend on project.xml in master directory) --subproject2   --project.xml (extend on project.xml in master directory) Emmanuel
        Hide
        Cameron Fieber added a comment -

        the structure is as you described in the first case, however the top level project.xml doesn't define any dependencies, it is just used to define the build structure, resources, repository, developers, and groupId.

        here's what happens:

        before:
        root

        -project.xml - just global values, developers, etc but no dependencies
        -componentA
          -api
            -project.xml (extends root project.xml)
          -impl
            -project.xml (extends root project.xml, depends on
        componentA-api)

        after (CVS update, someone added componentB, modified componentA-impl to use componentB):
        root

        -project.xml - just global values, developers, etc but no
        dependencies
        -componentA
          -api
            -project.xml (extends root project.xml)
          -impl
            -project.xml (extends root project.xml, depends on
        componentA-api, componentB-api)
        -componentB
          -api
            -project.xml (extends root project.xml)
          -impl
            -project.xml (extends root project.xml, depends on
        componentB-api

        What now happens, is that componentA has been built (has target directories), but you can't do a multiproject:clean because componentB-api hasn't been built yet and the multiproject:clean will detect the missing dependency for componentA-impl and fail.

        Show
        Cameron Fieber added a comment - the structure is as you described in the first case, however the top level project.xml doesn't define any dependencies, it is just used to define the build structure, resources, repository, developers, and groupId. here's what happens: before: root -project.xml - just global values, developers, etc but no dependencies -componentA   -api     -project.xml (extends root project.xml)   -impl     -project.xml (extends root project.xml, depends on componentA-api) after (CVS update, someone added componentB, modified componentA-impl to use componentB): root -project.xml - just global values, developers, etc but no dependencies -componentA   -api     -project.xml (extends root project.xml)   -impl     -project.xml (extends root project.xml, depends on componentA-api, componentB-api) -componentB   -api     -project.xml (extends root project.xml)   -impl     -project.xml (extends root project.xml, depends on componentB-api What now happens, is that componentA has been built (has target directories), but you can't do a multiproject:clean because componentB-api hasn't been built yet and the multiproject:clean will detect the missing dependency for componentA-impl and fail.
        Hide
        Emmanuel Venisse added a comment -

        OK, for resolve your problem, you can run :
        maven -Dgoal=clean,jar:install multiproject:goal

        this command line do a clean and a jar:install for each subproject, so your component will be install in your local repo.

        Show
        Emmanuel Venisse added a comment - OK, for resolve your problem, you can run : maven -Dgoal=clean,jar:install multiproject:goal this command line do a clean and a jar:install for each subproject, so your component will be install in your local repo.
        Hide
        Brett Porter added a comment -

        It's a good point, but it won't be fixed in 1.0 unfortunately

        Show
        Brett Porter added a comment - It's a good point, but it won't be fixed in 1.0 unfortunately
        Hide
        Håvard Bjåstad added a comment -

        I'd like to tack on to this one, even though my problem is with reactor (not multiproject). We have a J2EE project with several sub-projects, each building their own artifact. When running the reactor to build all sub-projects before they are included in the main project's EAR file, maven first looks for deployed jars. This doesn't make sense, as the reactor's job is to build the jars for all sub-projects! As mentioned above, I think the dependencies should be ignored on startup, if they are included in the reactor build.

        Show
        Håvard Bjåstad added a comment - I'd like to tack on to this one, even though my problem is with reactor (not multiproject). We have a J2EE project with several sub-projects, each building their own artifact. When running the reactor to build all sub-projects before they are included in the main project's EAR file, maven first looks for deployed jars. This doesn't make sense, as the reactor's job is to build the jars for all sub-projects! As mentioned above, I think the dependencies should be ignored on startup, if they are included in the reactor build.
        Hide
        Yassine Lajmi added a comment -

        For CruiseControl Use this :

        <goal name="clean-update-all">

        <echo>************************************</echo>
        <echo> Clean all </echo>
        <echo>************************************</echo>

        <j:catch var="exception">
        <attainGoal name="multiproject:clean"/>
        </j:catch>
        <j:if test="$

        {exception != null}

        ">
        <echo>#######################################</echo>
        <echo>Error while calling goal [$

        {goalName}

        ]:</echo>
        <echo> ************************************</echo>
        <echo> delete manually all target directories : </echo>
        <echo> ************************************</echo>
        <delete includeEmptyDirs="true">
        <fileset dir="$

        {basedir}

        ">
        <include name="**/target"/>
        </fileset>
        </delete>
        <echo>#######################################</echo>
        </j:if>

        <j:set var="maven.test.reportsDirectory" scope="parent" value="$

        {maven.build.dir}

        /test-reports"/>
        <echo>************************************</echo>
        <echo> prepare report dir : $

        {maven.test.reportsDirectory} </echo>
        <echo>************************************</echo>
        <mkdir dir="${maven.test.reportsDirectory}

        "/>

        <echo>************************************</echo>
        <echo> update project </echo>
        <echo>************************************</echo>
        <attainGoal name="scm:update-project"/>

        </goal>

        Show
        Yassine Lajmi added a comment - For CruiseControl Use this : <goal name="clean-update-all"> <echo>************************************</echo> <echo> Clean all </echo> <echo>************************************</echo> <j:catch var="exception"> <attainGoal name="multiproject:clean"/> </j:catch> <j:if test="$ {exception != null} "> <echo>#######################################</echo> <echo>Error while calling goal [$ {goalName} ]:</echo> <echo> ************************************</echo> <echo> delete manually all target directories : </echo> <echo> ************************************</echo> <delete includeEmptyDirs="true"> <fileset dir="$ {basedir} "> <include name="**/target"/> </fileset> </delete> <echo>#######################################</echo> </j:if> <j:set var="maven.test.reportsDirectory" scope="parent" value="$ {maven.build.dir} /test-reports"/> <echo>************************************</echo> <echo> prepare report dir : $ {maven.test.reportsDirectory} </echo> <echo>************************************</echo> <mkdir dir="${maven.test.reportsDirectory} "/> <echo>************************************</echo> <echo> update project </echo> <echo>************************************</echo> <attainGoal name="scm:update-project"/> </goal>

          People

          • Assignee:
            Unassigned
            Reporter:
            Cameron Fieber
          • Votes:
            7 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

            • Created:
              Updated: