Maven
  1. Maven
  2. MNG-2979

Cross module dependencies for multi-module site

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.0.5
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Linux 2.6.18-gentoo-r6 #2 SMP PREEMPT Wed Feb 28 10:25:50 CET 2007 i686 Pentium III (Coppermine) GenuineIntel GNU/Linux

      Description

      Considering a multi-module project A which declares two sub-projects (modules) B and C. Having module C indicating in its POM a dependency against module B. Compilation and packaging work great without having to install module B in maven local repository, it locate module B for module C using declared aggregation at top level project A.

      But for site goals it does not work, that is to say when maven try to generate site for module C it tells that module B artifact cannot be found. So we have to install module B to be able to generate module C site, whereas it is not necessary for compile or package goals.

      I think it would be great if site goals behaves like compile and package with aggregation. It would be more coherent, and avoid to have to run install just for site goals.

      1. build.log
        12 kB
        John Casey
      2. gwttk-m2.zip
        19 kB
        Mat Gessel
      3. maven.diff
        1 kB
        Tiago Bruno Pires Gomes
      4. maven.diff
        0.5 kB
        Tiago Bruno Pires Gomes
      5. maven-core-2.0.11-SNAPSHOT.jar
        160 kB
        Tiago Bruno Pires Gomes
      6. mng-2979-testcase.tar.gz
        2 kB
        Oran Kelly
      7. package.txt
        6 kB
        Mat Gessel
      8. site.txt
        8 kB
        Mat Gessel
      9. to-package.log
        10 kB
        John Casey

        Activity

        Hide
        Mat Gessel added a comment -

        I'm running into this issue in 2.0.6 as well.

        I'm going to attach several files:
        gwttk-m2.zip: a skeleton project demonstrating the issue (site goal fails on "sandbox" module)
        package.txt: the successful result of running "mvn package" in the root module directory
        site.txt: the failed result of running "mvn site" in the root module directory

        (Note: I also noticed that you cannot compile/package the child module independently unless its dependencies are checked into the repository )

        Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing:
        ----------
        1) net.asquare:gwttk:jar:0.2.3-SNAPSHOT

        Try downloading the file manually from the project website.

        Then, install it using the command:
        mvn install:install-file -DgroupId=net.asquare -DartifactId=gwttk \
        -Dversion=0.2.3-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

        Path to dependency:
        1) net.asquare:gwttk-sandbox:jar:0.2.3-SNAPSHOT
        2) net.asquare:gwttk:jar:0.2.3-SNAPSHOT

        ----------
        1 required artifact is missing.

        for artifact:
        net.asquare:gwttk-sandbox:jar:0.2.3-SNAPSHOT

        from the specified remote repositories:
        central (http://repo1.maven.org/maven2)

        at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:305)
        at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:272)
        at org.apache.maven.plugin.DefaultPluginManager.resolveTransitiveDependencies(DefaultPluginManager.java:1238)
        at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:397)
        at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
        ... 16 more

        Show
        Mat Gessel added a comment - I'm running into this issue in 2.0.6 as well. I'm going to attach several files: gwttk-m2.zip: a skeleton project demonstrating the issue (site goal fails on "sandbox" module) package.txt: the successful result of running "mvn package" in the root module directory site.txt: the failed result of running "mvn site" in the root module directory (Note: I also noticed that you cannot compile/package the child module independently unless its dependencies are checked into the repository ) Caused by: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing: ---------- 1) net.asquare:gwttk:jar:0.2.3-SNAPSHOT Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=net.asquare -DartifactId=gwttk \ -Dversion=0.2.3-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file Path to dependency: 1) net.asquare:gwttk-sandbox:jar:0.2.3-SNAPSHOT 2) net.asquare:gwttk:jar:0.2.3-SNAPSHOT ---------- 1 required artifact is missing. for artifact: net.asquare:gwttk-sandbox:jar:0.2.3-SNAPSHOT from the specified remote repositories: central ( http://repo1.maven.org/maven2 ) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:305) at org.apache.maven.artifact.resolver.DefaultArtifactResolver.resolveTransitively(DefaultArtifactResolver.java:272) at org.apache.maven.plugin.DefaultPluginManager.resolveTransitiveDependencies(DefaultPluginManager.java:1238) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:397) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539) ... 16 more
        Hide
        Mat Gessel added a comment -

        gwttk-m2.zip
        a skeleton project demonstrating the issue (site goal fails on "sandbox" module)

        package.txt
        the successful result of running "mvn package" in the root module directory

        site.txt
        the failed result of running "mvn site" in the root module directory

        Show
        Mat Gessel added a comment - gwttk-m2.zip a skeleton project demonstrating the issue (site goal fails on "sandbox" module) package.txt the successful result of running "mvn package" in the root module directory site.txt the failed result of running "mvn site" in the root module directory
        Hide
        Stepan Roh added a comment -

        I believe this is not a missing feature, but a bug. If in the chain of called goals is some with "@requiresDependencyResolution compile" then it works (e.g. compilation during compile phase in default lifecycle) otherwise it does not - can be tested by calling "mvn compile site".

        Show
        Stepan Roh added a comment - I believe this is not a missing feature, but a bug. If in the chain of called goals is some with "@requiresDependencyResolution compile" then it works (e.g. compilation during compile phase in default lifecycle) otherwise it does not - can be tested by calling "mvn compile site".
        Hide
        Brian E. Fox added a comment -

        Can you check this with 2.0.8? Seems like it might be related to MNG-2277

        Show
        Brian E. Fox added a comment - Can you check this with 2.0.8? Seems like it might be related to MNG-2277
        Hide
        Stepan Roh added a comment -

        I checked it with Maven 2.0.8 and it still does not work: "mvn site" fails, but "mvn compile site" runs OK.

        Show
        Stepan Roh added a comment - I checked it with Maven 2.0.8 and it still does not work: "mvn site" fails, but "mvn compile site" runs OK.
        Hide
        Andy Sinesio added a comment -

        This is still an issue with Maven 2.0.9 and is causing trouble for us.

        Show
        Andy Sinesio added a comment - This is still an issue with Maven 2.0.9 and is causing trouble for us.
        Hide
        Oran Kelly added a comment -

        We also have a multi-module project of the form:
        workspace/parent-module
        workspace/module1
        workspace/module2
        ...

        If we start with a local repository that has none of these modules deployed and utter "mvn clean install site" in the parent-module, the build fails because it cannot resolve module1 as a dependency.

        I have checked with the recently released 2.0.10 and 2.1.0 and the problem still exists in both.

        Show
        Oran Kelly added a comment - We also have a multi-module project of the form: workspace/parent-module workspace/module1 workspace/module2 ... If we start with a local repository that has none of these modules deployed and utter "mvn clean install site" in the parent-module, the build fails because it cannot resolve module1 as a dependency. I have checked with the recently released 2.0.10 and 2.1.0 and the problem still exists in both.
        Hide
        John Casey added a comment -

        I opened the gwttk-m2.zip file, cd'ed into the root directory, and executed the following:

        mvn clean install site
        

        using Maven 2.1.0 and JDK 1.4 on OS X 10.5, and had no problems. The attached build.log file reflects this. Note that I had made sure that all of net/asquare/** was removed from the local repository before doing so.

        As for the approach of simply calling `mvn site` from the root without building at least to the package phase at the same time, where is the jar file for the dependency supposed to come from if nothing is producing it? I'm re-checking this process using `mvn clean package site` now, and will report my results.

        Show
        John Casey added a comment - I opened the gwttk-m2.zip file, cd'ed into the root directory, and executed the following: mvn clean install site using Maven 2.1.0 and JDK 1.4 on OS X 10.5, and had no problems. The attached build.log file reflects this. Note that I had made sure that all of net/asquare/** was removed from the local repository before doing so. As for the approach of simply calling `mvn site` from the root without building at least to the package phase at the same time, where is the jar file for the dependency supposed to come from if nothing is producing it? I'm re-checking this process using `mvn clean package site` now, and will report my results.
        Hide
        John Casey added a comment -

        this is the result of removing all net/asquare/** from the local repository, verifying that `mvn site` by itself fails, then running:

        mvn clean package site
        

        As you can see, everything is functioning well here. I'm going to close this issue. If you can provide a failing test case that uses Maven 2.1.0, please reopen.

        Show
        John Casey added a comment - this is the result of removing all net/asquare/** from the local repository, verifying that `mvn site` by itself fails, then running: mvn clean package site As you can see, everything is functioning well here. I'm going to close this issue. If you can provide a failing test case that uses Maven 2.1.0, please reopen.
        Hide
        John Casey added a comment -

        This was probably fixed as part of the 2.1.0 release, but I'm leaving Fix-For at 2.2.0, since this is where I verified the problem as fixed.

        Show
        John Casey added a comment - This was probably fixed as part of the 2.1.0 release, but I'm leaving Fix-For at 2.2.0, since this is where I verified the problem as fixed.
        Hide
        Andy Sinesio added a comment -

        John, it looks like you didn't verify the problem properly. Running "mvn install site" is the workaround.

        The actual issue is that running "mvn site" in a multi-module project fails because Maven does not resolve dependencies properly.

        Show
        Andy Sinesio added a comment - John, it looks like you didn't verify the problem properly. Running "mvn install site" is the workaround. The actual issue is that running "mvn site" in a multi-module project fails because Maven does not resolve dependencies properly.
        Hide
        Oran Kelly added a comment -

        I have attached a test case that I have confirmed fails with Maven-2.1.0 (and 2.0.10)

        $ cd mng-2979/
        $ cd ..
        $ cd mng-2979/parent
        $ rm -fr $HOME/.m2/repository/com/test
        $ mvn clean install site
        [INFO] Scanning for projects...
        [INFO] Reactor build order:
        [INFO] Test Parent
        [INFO] Module 1
        [INFO] Module 2
        [INFO] ------------------------------------------------------------------------
        [INFO] Building Test Parent
        [INFO] task-segment: [clean, install, site]
        [INFO] ------------------------------------------------------------------------
        [INFO] [clean:clean]
        [INFO] [site:attach-descriptor]
        [INFO] [install:install]
        [INFO] Installing /tmp/mng-2979/parent/target/pom-transformed.xml to /home/test/.m2/repository/com/test/parent/1.0/parent-1.0.pom
        [INFO] Preparing surefire-report:report
        [INFO] No goals needed for project - skipping
        [INFO] Preparing surefire-report:report-only
        [INFO] No goals needed for project - skipping
        [INFO] Preparing javadoc:javadoc
        [INFO] No goals needed for project - skipping
        [INFO] Preparing javadoc:test-aggregate
        [INFO] ------------------------------------------------------------------------
        [INFO] Building Test Parent
        [INFO] ------------------------------------------------------------------------
        [INFO] No goals needed for project - skipping
        [INFO] ------------------------------------------------------------------------
        [INFO] Building Module 1
        [INFO] ------------------------------------------------------------------------
        [INFO] [resources:resources]
        [INFO] Using default encoding to copy filtered resources.
        [INFO] [compiler:compile]
        [INFO] Compiling 1 source file to /tmp/mng-2979/module1/target/classes
        [INFO] ------------------------------------------------------------------------
        [INFO] Building Module 2
        [INFO] ------------------------------------------------------------------------
        [INFO] [resources:resources]
        [INFO] Using default encoding to copy filtered resources.
        Downloading: http://repo1.maven.org/maven2/com/test/module1/1.0/module1-1.0.jar
        [INFO] Unable to find resource 'com.test:module1:jar:1.0' in repository central (http://repo1.maven.org/maven2)
        [INFO] ------------------------------------------------------------------------
        [ERROR] BUILD ERROR
        [INFO] ------------------------------------------------------------------------
        [INFO] Failed to resolve artifact.

        Missing:
        ----------
        1) com.test:module1:jar:1.0

        Try downloading the file manually from the project website.

        Then, install it using the command:
        mvn install:install-file -DgroupId=com.test -DartifactId=module1 -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file

        Alternatively, if you host your own repository you can deploy the file there:
        mvn deploy:deploy-file -DgroupId=com.test -DartifactId=module1 -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

        Path to dependency:
        1) com.test:module2:jar:1.0
        2) com.test:module1:jar:1.0

        ----------
        1 required artifact is missing.

        for artifact:
        com.test:module2:jar:1.0

        from the specified remote repositories:
        central (http://repo1.maven.org/maven2)

        [INFO] ------------------------------------------------------------------------
        [INFO] For more information, run Maven with the -e switch
        [INFO] ------------------------------------------------------------------------
        [INFO] Total time: 8 seconds
        [INFO] Finished at: Thu Apr 30 13:49:42 IST 2009
        [INFO] Final Memory: 47M/412M
        [INFO] ------------------------------------------------------------------------

        Show
        Oran Kelly added a comment - I have attached a test case that I have confirmed fails with Maven-2.1.0 (and 2.0.10) $ cd mng-2979/ $ cd .. $ cd mng-2979/parent $ rm -fr $HOME/.m2/repository/com/test $ mvn clean install site [INFO] Scanning for projects... [INFO] Reactor build order: [INFO] Test Parent [INFO] Module 1 [INFO] Module 2 [INFO] ------------------------------------------------------------------------ [INFO] Building Test Parent [INFO] task-segment: [clean, install, site] [INFO] ------------------------------------------------------------------------ [INFO] [clean:clean] [INFO] [site:attach-descriptor] [INFO] [install:install] [INFO] Installing /tmp/mng-2979/parent/target/pom-transformed.xml to /home/test/.m2/repository/com/test/parent/1.0/parent-1.0.pom [INFO] Preparing surefire-report:report [INFO] No goals needed for project - skipping [INFO] Preparing surefire-report:report-only [INFO] No goals needed for project - skipping [INFO] Preparing javadoc:javadoc [INFO] No goals needed for project - skipping [INFO] Preparing javadoc:test-aggregate [INFO] ------------------------------------------------------------------------ [INFO] Building Test Parent [INFO] ------------------------------------------------------------------------ [INFO] No goals needed for project - skipping [INFO] ------------------------------------------------------------------------ [INFO] Building Module 1 [INFO] ------------------------------------------------------------------------ [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. [INFO] [compiler:compile] [INFO] Compiling 1 source file to /tmp/mng-2979/module1/target/classes [INFO] ------------------------------------------------------------------------ [INFO] Building Module 2 [INFO] ------------------------------------------------------------------------ [INFO] [resources:resources] [INFO] Using default encoding to copy filtered resources. Downloading: http://repo1.maven.org/maven2/com/test/module1/1.0/module1-1.0.jar [INFO] Unable to find resource 'com.test:module1:jar:1.0' in repository central ( http://repo1.maven.org/maven2 ) [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Failed to resolve artifact. Missing: ---------- 1) com.test:module1:jar:1.0 Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -DgroupId=com.test -DartifactId=module1 -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file Alternatively, if you host your own repository you can deploy the file there: mvn deploy:deploy-file -DgroupId=com.test -DartifactId=module1 -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file -Durl= [url] -DrepositoryId= [id] Path to dependency: 1) com.test:module2:jar:1.0 2) com.test:module1:jar:1.0 ---------- 1 required artifact is missing. for artifact: com.test:module2:jar:1.0 from the specified remote repositories: central ( http://repo1.maven.org/maven2 ) [INFO] ------------------------------------------------------------------------ [INFO] For more information, run Maven with the -e switch [INFO] ------------------------------------------------------------------------ [INFO] Total time: 8 seconds [INFO] Finished at: Thu Apr 30 13:49:42 IST 2009 [INFO] Final Memory: 47M/412M [INFO] ------------------------------------------------------------------------
        Hide
        Tiago Bruno Pires Gomes added a comment -

        I worked on this, these last two days, and I have attached a diff file. It's pretty ugly but works fine.

        Show
        Tiago Bruno Pires Gomes added a comment - I worked on this, these last two days, and I have attached a diff file. It's pretty ugly but works fine.
        Hide
        Tiago Bruno Pires Gomes added a comment -

        Diff file correcting probably the problem (but very ugly)

        Show
        Tiago Bruno Pires Gomes added a comment - Diff file correcting probably the problem (but very ugly)
        Hide
        Tiago Bruno Pires Gomes added a comment -

        I tried to improve my last bugfix. So the only solution I've found is to do the maven goals successively. In other terms, mvn clean install site does :

        TestParent clean
        Module1 clean
        Module2 clean

        TestParent install
        Module1 install
        Module2 install

        TestParent site ...

        Show
        Tiago Bruno Pires Gomes added a comment - I tried to improve my last bugfix. So the only solution I've found is to do the maven goals successively. In other terms, mvn clean install site does : TestParent clean Module1 clean Module2 clean TestParent install Module1 install Module2 install TestParent site ...
        Hide
        Oran Kelly added a comment -

        This issue is marked fixed for version 2.2.0 but if I try to execute the attached test case (mng-2979-testcase.tar.gz) using Maven 2.2.0, I still get the same broken behaviour as before. What exactly was fixed for 2.2.0? Was it something other than what I demonstrated in the given test case and if so, should I open a separate Jira issue for it?

        Show
        Oran Kelly added a comment - This issue is marked fixed for version 2.2.0 but if I try to execute the attached test case (mng-2979-testcase.tar.gz) using Maven 2.2.0, I still get the same broken behaviour as before. What exactly was fixed for 2.2.0? Was it something other than what I demonstrated in the given test case and if so, should I open a separate Jira issue for it?
        Hide
        Ronald Kurr added a comment -

        I just wanted to add that I'm seeing the same behaviour under Maven 2.2.0. Like Oran said, it does not appear to be fixed. Maybe this ticket should be reopened?

        Show
        Ronald Kurr added a comment - I just wanted to add that I'm seeing the same behaviour under Maven 2.2.0. Like Oran said, it does not appear to be fixed. Maybe this ticket should be reopened?
        Hide
        Paul Benedict added a comment -

        Reopening based on the feedback of two users who apparently verified it isn't fixed. John, just close this again if confirmations turn out to be false.

        Show
        Paul Benedict added a comment - Reopening based on the feedback of two users who apparently verified it isn't fixed. John, just close this again if confirmations turn out to be false.
        Hide
        Guillaume Barry added a comment -

        Hi,
        I got the problem with maven 2.0.9
        mvn site or mvn clean install site doesn't work.

        mvn clean install is working and of course after that mvn site works (using local repository)

        is there a workaround with a single command line build ?

        Show
        Guillaume Barry added a comment - Hi, I got the problem with maven 2.0.9 mvn site or mvn clean install site doesn't work. mvn clean install is working and of course after that mvn site works (using local repository) is there a workaround with a single command line build ?
        Hide
        Shrini Joshi added a comment - - edited

        Do we have any workaround for this problem please?

        As Barry mentioned above we need a way to do this in single line as thats what we need to provide in Hudson config.

        Please leave us some comments.

        Shrini

        Show
        Shrini Joshi added a comment - - edited Do we have any workaround for this problem please? As Barry mentioned above we need a way to do this in single line as thats what we need to provide in Hudson config. Please leave us some comments. Shrini
        Hide
        René Zanner added a comment -

        A work-around is to configure two separate jobs in Hudson: one for building (clean install), the other for generating and deploying the site ("site site:deploy" or directly "site-deploy").

        We do it in our project: the normal build job is based on checking Subversion, the site build is time-based.

        Show
        René Zanner added a comment - A work-around is to configure two separate jobs in Hudson: one for building (clean install), the other for generating and deploying the site ("site site:deploy" or directly "site-deploy"). We do it in our project: the normal build job is based on checking Subversion, the site build is time-based.
        Hide
        Brett Porter added a comment -

        this is resolved in 3.0-alpha-5. mvn clean package site or mvn clean install site both work. mvn clean site works up until the point that the site report requires the module A dependency which was never built.

        Show
        Brett Porter added a comment - this is resolved in 3.0-alpha-5. mvn clean package site or mvn clean install site both work. mvn clean site works up until the point that the site report requires the module A dependency which was never built.

          People

          • Assignee:
            John Casey
            Reporter:
            Wally Wallou
          • Votes:
            14 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development