Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aether-users] resolving a POM with systemPaths

On 11/30/2011 06:33 AM, Benjamin Bentmann wrote:
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.
I am using the MavenRepositorySystemSession, which sets isIgnoreInvalidArtifactDescriptor to true in the constructor, so Aether is not stopping to toss an invalid artifact exception.

The issue is not that dependencies systemPath are not resolving, but everything is not resolving. I am sure I stumbled upon some wacky edge case. This only happens when resolving a POM that has a dependency that contains a dependency with a systemPath, two levels deep in the graph. POM -> Dependency -> Dependency w/ systemPath.


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.

Right now I want Aether to ignore dependencies with bad paths, but the systemPaths are stopping everything. DependencySelector sounds like a good work around for now that can be a runtime configuration. Thanks for the prompt reply and pointers!


thanks,
Michael



Back to the top