3.7.10 Deploying to a Maven Repository - Reference Documentation
Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith
Version: 2.0.4
3.7.10 Deploying to a Maven Repository
If you use Maven to build your Grails project, you can use the standard Maven targetsmvn install and mvn deploy.
If not, you can deploy a Grails project or plugin to a Maven repository using the maven-publisher plugin.The plugin provides the ability to publish Grails projects and plugins to local and remote Maven repositories. There are two key additional targets added by the plugin:
- maven-install - Installs a Grails project or plugin into your local Maven cache
- maven-deploy - Deploys a Grails project or plugin to a remote Maven repository
pom.xml for you unless a pom.xml is already present in the root of the project, in which case this pom.xml file will be used.maven-install
Themaven-install command will install the Grails project or plugin artifact into your local Maven cache:grails maven-install
maven-deploy
Themaven-deploy command will deploy a Grails project or plugin into a remote Maven repository:grails maven-deploy
<distributionManagement> configuration within a pom.xml or that you specify the id of the remote repository to deploy to:grails maven-deploy --repository=myRepo
repository argument specifies the 'id' for the repository. Configure the details of the repository specified by this 'id' within your grails-app/conf/BuildConfig.groovy file or in your $USER_HOME/.grails/settings.groovy file:grails.project.dependency.distribution = {
localRepository = "/path/to/my/local"
remoteRepository(id: "myRepo", url: "http://myserver/path/to/repo")
}<remoteRepository id="myRepo" url="scp://localhost/www/repository"> <authentication username="..." privateKey="${user.home}/.ssh/id_dsa"/> </remoteRepository>
remoteRepository(id: "myRepo", url: "scp://localhost/www/repository") { authentication username: "...", privateKey: "${userHome}/.ssh/id_dsa" }
grails maven-deploy --repository=myRepo --protocol=webdav
- http
- scp
- scpexe
- ftp
- webdav
Groups, Artifacts and Versions
Maven defines the notion of a 'groupId', 'artifactId' and a 'version'. This plugin pulls this information from the Grails project conventions or plugin descriptor.Projects
For applications this plugin will use the Grails application name and version provided by Grails when generating thepom.xml file. To change the version you can run the set-version command:grails set-version 0.2
groupId will be the same as the project name, unless you specify a different one in Config.groovy:grails.project.groupId="com.mycompany"Plugins
With a Grails plugin thegroupId and version are taken from the following properties in the GrailsPlugin.groovy descriptor:String groupId = 'myOrg' String version = '0.1'
FeedsGrailsPlugin the artifactId will be "feeds". If your plugin does not specify a groupId then this defaults to "org.grails.plugins".

