.. a hollow voice says 'Plugh'.
I just built again this morning, and it's doing something slightly
different, but it's still not resolving mavenprojects with properties
in them correctly.
Is this stuff still being worked on in 2.1 - I.E is it stable?
Am I supposed to replace things like
resolver.resolve( artifact, remoteRepositories, localRepository );
File artifactFile = artifact.getFile();
(from the mojo developers cookbook) with
ArtifactResolutionRequest arr = new ArtifactResolutionRequest();
arr.setArtifact(artifact);
// set some large number of parameters
ArtifactResolutionResult ares = getResolver().resolve( arr );
File artifactFile = artifact.getFile();
? (and the fact artifactFile == null is down to me not geting the
resolution request runes correct) ?
or should I be using
String path = getLocalRepository().pathOf(artifact);
File artifactFile = new File( new
File(getLocalRepository().getBasedir()), path );
?
What about
MavenProject mavenProject =
getMavenProjectBuilder().buildFromRepository(artifact,
getRemoteRepositories(), getLocalRepository() );
Does that rely on the artifact having been resolved? Have I missed
some new API ?
On Jan 14, 2008 1:05 PM, Nigel Magnay <[EMAIL PROTECTED]> wrote:
> Hello.
>
> I'm trying to adapt some old code from a plugin into a standalone
> project, so I've been looking at the maven Embedder. Since this seems
> to be dead in the current releases, I've moved to the 2.1-SNAPSHOTS.
> However, some things that I used to do have changed, and I'm
> experiencing the rising wave of frustration that I get whenever I get
> anywhere near the maven codebase.
>
> I'm sure it's really simple, but I'm getting a bit lost.
>
> With an artifact I used to do
> resolver.resolve(artifact, remoteRepositories, localRepository);
> File artifactFile = artifact.getFile();
> MavenProject mavenProject = mavenProjectBuilder.buildFromRepository(
> artifact, remoteRepositories,
> localRepository);
> for(Iterator i = mavenProject.createArtifacts(getArtifactFactory(),
> null, null).iterator(); i.hasNext();)
> {
> // blah blah blah etc
> }
>
> Now it appears I'm supposed to use an ArtifactResolutionRequest, and
> make sure a lot of extraneous parameters are set. But, the
> mavenProject that I get back hasn't resolved any variables defined in
> the pom in the repository (I.E I get a version of ${my-property-value}
> rather than a resolved value, that I used to get before). Have I
> missed something, or more likely failed to set some parameter
> somewhere?
>
> Also, one of the things I don't understand is the way the Artifact
> interfaces are designed. Surely an 'unresolved' Artifact
> (getFile()==null) and a 'resolved' artifact (getFile()!=null) are
> different things? The 1st is a coordinate (or a handle), and the
> latter is an actual instance? Having the artifact 'changed' by feeding
> it through a resolve() or an ArtifactResolver feels a bit too magic to
> me.. Also the ArtifactResolutionRequest passed to ArtifactResolver
> seems to me to be more complex than before (where I just passed local
> and remote repositories) - now I've got to set artifact dependencies
> (to an empty set) to prevent NPEs elsewhere. And even the
> ArtifactResolutionRequest contains an ArtifactRepository?!? Why isn't
> it more like 'here's an interface that takes a coordinate and gives
> you an artifact', if that's a local repository, it's easy, if it's a
> 'resolver' it may cause a download ?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]