[
https://issues.apache.org/jira/browse/MDEP-516?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15491423#comment-15491423
]
Petar Tahchiev commented on MDEP-516:
-------------------------------------
Hi Robert,
I tried replacing the {{requiresDependencyResolution = ResolutionScope.TEST}}
with {{requiresDependencyCollection = ResolutionScope.TEST}} in
maven-dependency-plugin, and then I tried to run:
{code}
mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.0-SNAPSHOT:go-offline
org.apache.maven.plugins:maven-dependency-plugin:3.0.0-SNAPSHOresolve-plugins
{code}
which finished with SUCCESS. But then I try to build the project with {{-o}}
and the build fails because it cannot find:
{code}
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>
{code}
anyways I run it without {{-o}} and then I see it starts downloading tons of
dependencies for maven plugins that I have declared:
{code}
[INFO] --- maven-site-plugin:3.5.1:attach-descriptor (attach-descriptor) @
platform ---
Downloading:
https://repository.nemesis.io/artifactory/libs-release/org/asciidoctor/asciidoctor-maven-plugin/1.5.3/asciidoctor-maven-plugin-1.5.3.pom
Downloaded:
https://repository.nemesis.io/artifactory/libs-release/org/asciidoctor/asciidoctor-maven-plugin/1.5.3/asciidoctor-maven-plugin-1.5.3.pom
(18 KB at 60.0 KB/sec)
Downloading:
https://repository.nemesis.io/artifactory/libs-release/org/jruby/jruby-complete/1.7.23/jruby-complete-1.7.23.pom
Downloaded:
https://repository.nemesis.io/artifactory/libs-release/org/jruby/jruby-complete/1.7.23/jruby-complete-1.7.23.pom
(9 KB at 39.6 KB/sec)
Downloading:
https://repository.nemesis.io/artifactory/libs-release/org/jruby/jruby-artifacts/1.7.23/jruby-artifacts-1.7.23.pom
Downloaded:
https://repository.nemesis.io/artifactory/libs-release/org/jruby/jruby-artifacts/1.7.23/jruby-artifacts-1.7.23.pom
(4 KB at 16.9 KB/sec)
Downloading:
https://repository.nemesis.io/artifactory/libs-release/org/jruby/jruby-parent/1.7.23/jruby-parent-1.7.23.pom
Downloaded:
https://repository.nemesis.io/artifactory/libs-release/org/jruby/jruby-parent/1.7.23/jruby-parent-1.7.23.pom
(24 KB at 126.5 KB/sec)
Downloading:
https://repository.nemesis.io/artifactory/libs-release/org/asciidoctor/asciidoctorj/1.5.3.2/asciidoctorj-1.5.3.2.pom
Downloaded:
https://repository.nemesis.io/artifactory/libs-release/org/asciidoctor/asciidoctorj/1.5.3.2/asciidoctorj-1.5.3.2.pom
(3 KB at 13.2 KB/sec)
Downloading:
https://repository.nemesis.io/artifactory/libs-release/org/jruby/jruby-complete/1.7.21/jruby-complete-1.7.21.pom
Downloaded:
https://repository.nemesis.io/artifactory/libs-release/org/jruby/jruby-complete/1.7.21/jruby-complete-1.7.21.pom
(9 KB at 33.2 KB/sec)
Downloading:
https://repository.nemesis.io/artifactory/libs-release/org/jruby/jruby-artifacts/1.7.21/jruby-artifacts-1.7.21.pom
{code}
So I tried specifying all the plugins in my command:
{code}
mvn org.apache.maven.plugins:maven-dependency-plugin:3.0.0-SNAPSHOT:go-offline
org.apache.maven.plugins:maven-dependency-plugin:3.0.0-SNAPSHOT:resolve-plugins
proguard:proguard site:attach-descriptor
{code}
but then surefire failed:
{code}
[ERROR] ----------
[ERROR] 1) org.apache.maven.surefire:surefire-junit47:jar:2.19
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven.surefire
-DartifactId=surefire-junit47 -Dversion=2.19 -Dpackaging=jar
-Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file
there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven.surefire
-DartifactId=surefire-junit47 -Dversion=2.19 -Dpackaging=jar
-Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR] Path to dependency:
[ERROR] 1) dummy:dummy:jar:1.0
[ERROR] 2) org.apache.maven.surefire:surefire-junit47:jar:2.19
{code}
Do I really need to specify all the plugins when I say {{go-offline}}? Because
that actually defeats the purpose of it - in CircleCI you need to specify a
command that will be executed after they restore local repository from cache.
If I specify, surefire:test, failsafe:test, generate a site, proguard, etc to
download all dependencies then I'm actually building the project, before I get
to the command that builds the project.
> Go-offline does not find module dependencies in multi-module build.
> -------------------------------------------------------------------
>
> Key: MDEP-516
> URL: https://issues.apache.org/jira/browse/MDEP-516
> Project: Maven Dependency Plugin
> Issue Type: Bug
> Components: go-offline
> Affects Versions: 2.10
> Reporter: Petar Tahchiev
>
> Hello,
> I've recently hit the exact same problem that these guys are having:
> http://stackoverflow.com/questions/14694139/how-to-resolve-dependencies-between-modules-within-multi-module-project
> and I thought it must be a very normal scenario so probably a lot of other
> people are hitting.
> So basically I have a multi-module build where {{moduleA}} is built first and
> them {{moduleB}} depends on {{moduleA}}. However when I do {{mvn
> dependency:go-offline}} it comes to resolve the dependencies of {{moduleB}}
> and it fails with {{Artifact not found: moduleA}}.
> That seems to happen because only modules that have been packaged are put in
> the reactor and so later modules will know about them. So to fix it I have to
> do the following:
> {code}
> mvn package dependency:go-offline -U -Pquick,test -DskipTests -s
> src/main/resources/settings.xml
> {code}
> which I really don't like, because it does an extra package that I don't
> need, and then the whole build gets a lot slower.
> of course, {{mvn install}} at any time fixes the issue also, but I don't want
> to install
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)