You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Marco Seguri (Jira)" <ji...@apache.org> on 2021/09/29 15:55:00 UTC

[jira] [Commented] (MDEP-759) 'Dependency not found' with 3.2.0 and Java-17 while analyzing

    [ https://issues.apache.org/jira/browse/MDEP-759?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17422209#comment-17422209 ] 

Marco Seguri commented on MDEP-759:
-----------------------------------

I'm trying to upgrade a project to Java 17; I've updated the pom to `maven-dependency-plugin:3.2.0` (cause 3.1.2 is not supported) and we are using `basepom-minimal:40`, and I get:

```

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.2.0:analyze-only (basepom.default) on project myproject: Execution basepom.default of goal org.apache.maven.plugins:maven-dependency-plugin:3.2.0:analyze-only failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-dependency-plugin:3.2.0:analyze-only: java.lang.NoSuchMethodError: 'java.util.Set org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis.getTestArtifactsWithNonTestScope()'
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-dependency-plugin:3.2.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy

```

> 'Dependency not found' with 3.2.0 and Java-17 while analyzing
> -------------------------------------------------------------
>
>                 Key: MDEP-759
>                 URL: https://issues.apache.org/jira/browse/MDEP-759
>             Project: Maven Dependency Plugin
>          Issue Type: Bug
>          Components: analyze
>    Affects Versions: 3.2.0
>            Reporter: Naman Nigam
>            Priority: Critical
>
> One of [the project|https://github.com/mrwilson/java-8-matchers] that I was looking into has these relevant configurations:
>     <maven.compiler.source>1.8</maven.compiler.source>
>     <maven.compiler.target>1.8</maven.compiler.target>
>     <plugin>
>         <artifactId>maven-dependency-plugin</artifactId>
>         <version>3.1.2</version>
>         <configuration>
>             <failOnWarning>true</failOnWarning>
>         </configuration>
>         <executions>
>             <execution>
>                 <goals>
>                     <goal>analyze-only</goal>
>                 </goals>
>             </execution>
>         </executions>
>     </plugin>
>     <dependency>
>         <groupId>org.hamcrest</groupId>
>         <artifactId>hamcrest</artifactId>
>         <version>2.2</version>
>         <!-- not scoped to test -->
>     </dependency>
> The build succeeds as expected on executing `mvn clean verify` (apache-maven-3.6.3). I have now, made a change in the properties to **upgrade**  the dependency plugin version:
>      <version>3.2.0</version>
> and the logs on the terminal read 
> >     [INFO] --- maven-dependency-plugin:3.2.0:analyze-only (default) @ java-8-matchers ---
> >     [WARNING] Non-test scoped test only dependencies found:
> >     [WARNING]    org.hamcrest:hamcrest:jar:2.2:compile
> leading to a failure(because of warning)! Why/How is the dependency treated differently with the upgrade in  version? Any way to fix this?
> ----------
> If it might be of help, the debug logs for this goal reads:
> ```
> [DEBUG] Configuring mojo org.apache.maven.plugins:maven-dependency-plugin:3.2.0:analyze-only from plugin realm ClassRealm[plugin>org.apache.maven.plugins:maven-dependency-plugin:3.2.0, parent: jdk.internal.loader.ClassLoaders$AppClassLoader@579bb367]
> [DEBUG] Configuring mojo 'org.apache.maven.plugins:maven-dependency-plugin:3.2.0:analyze-only' with basic configurator -->
> [DEBUG]   (f) analyzer = default
> [DEBUG]   (f) baseDir = .../java-8-matchers
> [DEBUG]   (f) failOnWarning = true
> [DEBUG]   (f) ignoreNonCompile = false
> [DEBUG]   (f) ignoreUnusedRuntime = false
> [DEBUG]   (f) outputDirectory = .../java-8-matchers/target
> [DEBUG]   (f) outputXML = false
> [DEBUG]   (f) project = MavenProject: uk.co.probablyfine:java-8-matchers:2.0.0-SNAPSHOT @ .../java-8-matchers/pom.xml
> [DEBUG]   (f) scriptableFlag = $$%%%
> [DEBUG]   (f) scriptableOutput = false
> [DEBUG]   (f) skip = false
> [DEBUG]   (f) verbose = false
> [DEBUG] -- end configuration --
> [WARNING] Non-test scoped test only dependencies found:
> [WARNING]    org.hamcrest:hamcrest:jar:2.2:compile
> [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.2.0:analyze-only (default) on project java-8-matchers: Dependency problems found -> [Help 1]
> org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.2.0:analyze-only (default) on project java-8-matchers: Dependency problems found
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
> ```
> Reproducible with Java-17(since that was the reason for me to upgrade from 3.1.2 to 3.2.0) using:
> 1. Git checkout [this branch|https://github.com/namannigam/java-8-matchers/tree/modular-artifact].
> 2. Configure maven to use Java-17.
> 3. Edit the `failOnWarning` property to `true`.
> 4. Execute `mvn clean verify`.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)