I'm currently trying to write a plugin to deploy a project to an application server. This project is of a type not currently buildable by Maven so my plan of action is to manually build the artifact and deploy it to my internal remote repository (deploy:deployfile) and then get Maven to resolve this artifact to the local repository and deploy it from there. I already have the code necessary to deploy the artifact, I'm just trying to hook it into Maven, and I need to get maven to download the artifact to the local repository and then give me it's path there.
I've been teaching myself the Maven api using a tutorial project. The code above gives me different results depending on the phase I define, so this probably not an accurate exercise as my mojo will not be bound to the lifecycle. I think I'm missing a couple pieces to my puzzle right now:
1) The DefaultArtifactResolver class's resolve(Artifact, List, ArtifactRepository) method takes an ArtifactRepository parameter which specifies the local repository. I can't figure out where to find this as the MavenProject doesn't seem to supply it. MavenProject.getRepositores() returned only remote repositories for me when trying it. If I could figure out the ArtifactRepositoryLayout class I might be able to generate a DefaultArtifactRepository from scratch but for portability this information should really come from the currently running installation of Maven's "conf/settings.xml" file (or a profile if that's possible?).
2) Actually due to the lack of information in the javadoc I'm really just guessing that the ArtifactResolver's resolve method will, in fact, download the specified Artifact to the local repository and update the value returned by the Artifact.getFile() method. I could be off base here.
Any input on how to accomplish these tasks in maven is greatly appreciated.
Martijn Verburg wrote:Have you tried using some of the existing deployment plugins for maven such as Jboss and cargo?
Yep, What I'm trying to deploy is an Oracle Service Bus configuration jar. The above mentioned tools can deploy WARs, EARs, and JARs as applications and libraries I'm sure, but this artifact is very proprietary and specialized.
...
I'm really terribly surprised at the javadocs online for Maven2. There are javadocs generated from source, but virtually no human written class/member descriptions.
You're best bet is to ask your question on the maven developers list in that case (you might get lucky here, but the maven-dev list is specialised for those sorts of questions).
Best of luck!
Emilio Kazwell
Ranch Hand
Joined: Aug 28, 2009
Posts: 37
posted
0
Ok. Thanks, Martijn.
Emilio Kazwell
Ranch Hand
Joined: Aug 28, 2009
Posts: 37
posted
0
Just in case anyone has similar questions in the future this page is the result of asking around on the developer forums: