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]

Reply via email to