[ https://issues.apache.org/jira/browse/MDEP-690?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17273481#comment-17273481 ]
Stephen Coy edited comment on MDEP-690 at 1/28/21, 10:13 AM: ------------------------------------------------------------- This has just bitten us too. {{go-offline}} should not be downloading optional dependencies at all. If the end user requires the dependency then they must declare it explicitly sans the {{optional}} tag, otherwise they would never see it at runtime. was (Author: sfcoy): go-offline should not be downloading optional dependencies at all. If the end user requires the dependency then they must declare it explicitly sans the `optional` tag, otherwise they would never see it at runtime. > go-offline fails when optional dependencies cannot be resolved > -------------------------------------------------------------- > > Key: MDEP-690 > URL: https://issues.apache.org/jira/browse/MDEP-690 > Project: Maven Dependency Plugin > Issue Type: Bug > Components: go-offline > Affects Versions: 3.1.2 > Reporter: Stephan Schroevers > Priority: Major > > Consider the following dummy project: > {code:xml} > <?xml version="1.0" encoding="UTF-8"?> > <project xmlns="http://maven.apache.org/POM/4.0.0" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > https://maven.apache.org/xsd/maven-4.0.0.xsd"> > <modelVersion>4.0.0</modelVersion> > <groupId>com.example</groupId> > <artifactId>example</artifactId> > <version>0.0.1-SNAPSHOT</version> > <dependencies> > <dependency> > <groupId>io.projectreactor.addons</groupId> > <artifactId>reactor-extra</artifactId> > <version>3.3.3.RELEASE</version> > </dependency> > </dependencies> > </project> > {code} > Running {{org.apache.maven.plugins:maven-dependency-plugin:3.1.1:go-offline}} > against this project passes. With version 3.1.2 the goal fails with: > {noformat} > org.eclipse.aether.resolution.DependencyResolutionException: Could not find > artifact org.eclipse.swt:org.eclipse.swt.gtk.linux.x86_64:jar:4.5.2 in > central (https://repo.maven.apache.org/maven2) > {noformat} > The reason for the failure appears to be that {{reactor-extra}} declares an > [optional|https://repo1.maven.org/maven2/io/projectreactor/addons/reactor-extra/3.3.3.RELEASE/reactor-extra-3.3.3.RELEASE.pom] > dependency on {{org.eclipse.swt.gtk.linux.x86_64}}, an artifact which is not > present in Maven Central. > It'd be nice if the version 3.1.1 behavior of the plugin could be reinstated. > Alternatively (perhaps better?) it should be possible to conditionally > exclude optional dependencies, just like the goal allows one to exclude > dependencies by artifact ID, group ID, classifier, scope and type. -- This message was sent by Atlassian Jira (v8.3.4#803005)