3.7.10 部署到Maven存储库 - Reference Documentation
Authors: Graeme Rocher, Peter Ledbrook, Marc Palmer, Jeff Brown, Luke Daley, Burt Beckwith
Version: null
3.7.10 部署到Maven存储库
If you use Maven to build your Grails project, you can use the standard Maven targets
如果你是使用Maven来构建你的Grails工程,那么你可以使用标准的Maven目标命令(target)mvn 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.
mvn install和mvn deploy来安装部署。
如果不是,你可以通过maven-publisher插件来将Grails工程或者插件部署到Maven存储库。此插件能够将Grails工程和插件发布到本地和远程的Maven存储库,下面是此插件额外的目标命令:
- maven-install - 安装Grails工程或者插件到你本地的Maven缓存中
- maven-deploy - 部署Grails工程或者插件到远程的Maven存储库中
pom.xml,此插件将为你自动生成此文件,否则系统将直接使用已经存在的pom.xml文件。maven-install
Themaven-install command will install the Grails project or plugin artifact into your local Maven cache:grails maven-install
maven-install
maven-install命令将安装Grails工程或者插件到你本地的Maven缓存: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
maven-deploy
maven-deploy命令将Grails工程或者插件发布到远程的Maven存储库:grails maven-deploy
pom.xml文件的<distributionManagement>,或者你可以通过指定远程存储库id的方式,比如:grails maven-deploy --repository=myRepo
repository参数是存储库的'id',此'id'的详细配置位于grails-app/conf/BuildConfig.groovy或者$USER_HOME/.grails/settings.groovy文件中: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"组,工件和版本
在Maven中,定义了'groupId','artifactId'和'version'概念,Maven插件会将Grails工程或者插件的描述转换为这些相应的定义。工程
对于一个应用来说,当要生成pom.xml文件的时候,此插件会根据Grails应用提供的名称和版本进行生成。要修改版本信息,可以运行set-version命令来完成:grails set-version 0.2
groupId跟其工程名称一样,不过你可以在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".
插件
对于一个Grails插件来说,其groupId和version来自于*GrailsPlugin.groovy文件的描述属性:String groupId = 'myOrg' String version = '0.1'
FeedsGrailsPlugin那么其artifactId是"feeds"。如果你的插件没有指定groupId那么其缺省值为"org.grails.plugins"。

