【问题标题】:Maven dependecy:go-offline doesn't download transitive dependenciesMaven dependecy:go-offline doesn\'t download transitive dependencies
【发布时间】:2022-12-26 21:53:56
【问题描述】:

I wantto add a separate dependency layer to my dockerfile.

I'm runningmvn dependencies:go-offline but after that mvn install -o reports that not all deps are found. After inspecting the error message it turned out that no transitive dependencies were downloading. The issue was fixed by explicitly defining all missing packages in pom.xml, but obviously it's not ideal.

This is my dockerfile

// copy pom.xml

RUN ./mvnw dependency:go-offline

// copy source code

RUN ./mvnw install -o

Is there an alternative to dependency:go-offline, or a flag for that command, that willdownload all dependenciesneeded to run install -o, not just direct ones?

UPD:This are the missing dependencies

[WARNING] The POM for javax.xml.bind:jaxb-api:jar:2.3.1 is missing, no dependency information available
[WARNING] The POM for net.bytebuddy:byte-buddy:jar:1.11.22 is missing, no dependency information available
[WARNING] The POM for org.glassfish.jaxb:jaxb-runtime:jar:2.3.6 is missing, no dependency information available
[WARNING] The POM for org.hamcrest:hamcrest-core:jar:2.2 is missing, no dependency information available
[WARNING] The POM for org.webjars:webjars-locator-core:jar:0.48 is missing, no dependency information available
[WARNING] The POM for org.apache.httpcomponents:httpcore:jar:4.4.15 is missing, no dependency information available
[WARNING] The POM for commons-codec:commons-codec:jar:1.15 is missing, no dependency information available

【问题讨论】:

  • use ./mvnw dependency:resolve-plugins dependency:go-offline which should include all plugins needed.
  • @M.Deinum It downloaded a lot more stuff but still the same missing dependencies
  • @M.Deinum go-offline already does that. "resolves all project dependencies,including plugins"
  • No it doesn't and is an known issue.

标签: java spring docker maven


【解决方案1】:

I faced the same issue. For some reason, dependency:go-offline doesn't add pom files to the local repository.

Instead, use mvn verify followed by mvn package:

// copy pom.xml
RUN ./mvnw verify --fail-never

// copy source code
RUN ./mvnw package -DskipTests -o

Check out a similar topic here.

【讨论】:

    猜你喜欢
    • 2019-03-09
    • 2022-12-01
    • 2022-12-01
    • 2022-12-27
    • 2022-12-01
    • 2022-12-27
    • 2022-12-02
    • 2022-12-27
    • 2012-01-31
    相关资源
    最近更新 更多