It turns out that it is not that difficult to convert a project to be built using Maven. Here are the steps I went through:
- Set up a repository – I’m using Artifactory
- Set permissions on the repository to allow a user to write to it
- Get the settings.xml file for Maven configuration
- Add the user authentication information to the downloaded settings file
- For each project in Eclipse
- Add a Maven nature
- Add the repository to the distributionManagement section of the generated pom.xml file
- Add a debug configuration for ‘Maven build…’
- Give a goal of ‘deploy’ and the path to the settings file from the repository
- Attempt a build and resolve any missing dependencies
- When the build is successful the output will be published to the repository
The two most complicated parts of this process were getting the user permissions right and resolving dependencies. The permissions is the usual dance of trying to use the right username and setting the correct permissions for all of the repositories, it is documented and fairly clear once you’ve got it all set up right. Atrifactory has an ‘access.log’ (which you can see in System Logs admin screen) which shows permission results, it is a good place to check if you are getting errors when deploying. During the setup phase I was building again with the same version number, which requires the ‘delete’ permission.
More interesting is resolving the dependencies, mostly searching Google for the package that reported an error gave a link on Maven Repository which contains an XML snippet to add the dependency information to the pom.xml file. I didn’t encounter any conflicts during this process as I was, for the most part, using versions already known to work but obtained from other sources. I’ll be writing a bit more about versions shortly, when I try to bring everything up to date.