[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aether-users] resolving a POM with systemPaths
|
Michael Guymon wrote:
<dependency>
<groupId>google</groupId>
<artifactId>gdata-spreadsheet</artifactId>
<version>3.0</version>
<type>jar</type>
<scope>system</scope>
<systemPath>${project.basedir}/lib/gdata/gdata-spreadsheet-3.0.jar</systemPath>
Note that usage of ${basedir} for system scope dependencies is generally
non-portable which is why you will find Maven 3.0.3 produce a warning
when building projects with such a dependency declaration.
The proper way to consume artifacts is from repositories, either a
public forge, your private repo manager or at least your local repository.
This causes Aether's dependency resolution to fail and return no
results.
The resolution fails because dependencies as opposed to projects have no
basedir.
Also, do note that there's a isIgnoreInvalidArtifactDescriptor property
that can be set on the RepositorySystemSession (which Maven does). This
will prevent Aether itself from bailing out with an exception.
Is it possible to have Aether ignore dependencies with a
system scope?
Sure, but there are two things at play here.
The error you posted originates from Maven's model validator,
complaining about the unknown property ${project.basedir}. To get past
that and have access to the POM's dependencies, you would have to set
that property to some dummy value in the user or system properties of
Aether's repo session.
Next, have a look at [0] for an overview of available extension points
to tweak the dependency graph. What you need is a DependencySelector
that kicks out the system scope dependencies, either only those with bad
system paths or all of them, as you need.
Do note however that such a resolution behavior differs from Maven. It
considers POMs with bad system paths invalid and ignores their entire
contents.
Benjamin
[0] https://docs.sonatype.org/display/AETHER/Introduction