Phillip Scott Givens
Phillip Scott Givens

Reputation: 5464

Maven 3.0 Artifact Repository API Deprecation

I am attempting to write a Maven plugin using the ArtifactInstaller and the ArtifactDeployer. The methods that make the most sense to me are deprecated with the following message:

"we want to use the artifact method only, and ensure artifact.file is set correctly."

I do not know what that means. These classes do not have an "artifact method." How do I install and how do I deploy artifacts with the Maven 3.0.5 API?

[Edit] Looking again, what I really need is to be able to create an artifact to pass to the non-deprecated methods. All of the methods on ArtifactFactory are now deprecated.

http://maven.apache.org/ref/3.0.5/apidocs/org/apache/maven/artifact/factory/ArtifactFactory.html

Upvotes: 4

Views: 1498

Answers (1)

Phillip Scott Givens
Phillip Scott Givens

Reputation: 5464

It is morning and I am seeing things clearer; I am answering my own question. The trick is to replace RepositoryFactory [1] with RepositorySystem [2]. For a full description, I was trying to follow the guidance of the following article.

http://docs.codehaus.org/display/MAVENUSER/Mojo+Developer+Cookbook#MojoDeveloperCookbook-Foraccessingartifactsandrepositories

When I look through the documentation, everything in ArtifactFactory is deprecated and it seems that there is not a good way to get an Artifact. The first thing I needed to do was replace this class with RepositorySystem. I also had to change my pom.xml to include

<dependency>
    <groupId>org.apache.maven</groupId>
    <artifactId>maven-compat</artifactId>
    <version>3.0.5</version>
</dependency>

[1] http://maven.apache.org/ref/3.0.5/apidocs/org/apache/maven/artifact/factory/ArtifactFactory.html

[2] http://maven.apache.org/ref/3.0.5/maven-compat/apidocs/org/apache/maven/artifact/deployer/ArtifactDeployer.html

Upvotes: 3

Related Questions