Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

updated maven publisher plugin to attach the plugin.xml file to the p…

…ublished maven artifact
  • Loading branch information...
commit f188ce2fa6928534c80f3d3562798a26d3788e8a 1 parent 396a8fc
@graemerocher graemerocher authored
View
2  grails-plugins/maven-publisher/MavenPublisherGrailsPlugin.groovy
@@ -1,5 +1,5 @@
class MavenPublisherGrailsPlugin {
- def version = "0.1"
+ def version = "0.2"
// the version or versions of Grails the plugin is designed for
def grailsVersion = "1.2 > *"
// resources that are excluded from plugin packaging
View
6 grails-plugins/maven-publisher/application.properties
@@ -1,6 +1,6 @@
#Grails Metadata file
#Thu Feb 04 12:34:47 CET 2010
-app.grails.version=1.2.1
+app.grails.version=1.3.0.BUILD-SNAPSHOT
app.name=maven-publisher
-plugins.hibernate=1.2.1
-plugins.tomcat=1.2.1
+plugins.hibernate=1.3.0.BUILD-SNAPSHOT
+plugins.tomcat=1.3.0.BUILD-SNAPSHOT
View
50 grails-plugins/maven-publisher/scripts/_GrailsMaven.groovy
@@ -113,13 +113,36 @@ if(!basePom.exists()) {
target(mavenInstall:"Installs a plugin or application into your local Maven cache") {
def deployFile = plugin ? new File(pluginZip) : grailsSettings.projectWarFile
def ext = plugin ? "zip" : "war"
+ installOrDeploy(deployFile, ext, false)
+}
+
+private installOrDeploy(File file, ext, boolean deploy, repos = [:]) {
+ if(deploy) {
+ parseArguments()
+ }
ant.checksum file:pom, algorithm:"sha1", todir:projectTargetDir
- ant.checksum file:deployFile, algorithm:"sha1", todir:projectTargetDir
- artifact.install(file: deployFile) {
- attach file:"${projectTargetDir}/pom.xml.sha1",type:"pom.sha1"
- attach file:"${projectTargetDir}/${deployFile.name}.sha1",type:"${ext}.sha1"
+ ant.checksum file:file, algorithm:"sha1", todir:projectTargetDir
+ artifact."${ deploy ? 'deploy' : 'install' }"(file: file) {
+ if(ext == 'zip') {
+ attach file:"${basedir}/plugin.xml",type:"plugin.xml"
+ }
+ attach file:"${projectTargetDir}/pom.xml.sha1",type:"pom.sha1"
+ attach file:"${projectTargetDir}/${file.name}.sha1",type:"${ext}.sha1"
pom(file: pom)
- }
+ if(repos.remote) {
+ def repo = repos.remote
+ if(repo.configurer) {
+ remoteRepository(repo.args, repo.configurer)
+ }
+ else {
+ remoteRepository(repo.args)
+ }
+ }
+ if(repos.local) {
+ localRepository(path:repos.local)
+ }
+
+ }
}
target(mavenDeploy:"Deploys the plugin to a Maven repository") {
@@ -166,22 +189,7 @@ target(mavenDeploy:"Deploys the plugin to a Maven repository") {
def ext = plugin ? "zip" : "war"
ant.checksum file:deployFile, algorithm:"sha1", todir:projectTargetDir
try {
- artifact.deploy(file: deployFile) {
- attach file:"${projectTargetDir}/pom.xml.sha1",type:"pom.sha1"
- attach file:"${projectTargetDir}/${deployFile.name}.sha1",type:"${ext}.sha1"
- pom(file: pom)
- if(repo) {
- if(repo.configurer) {
- remoteRepository(repo.args, repo.configurer)
- }
- else {
- remoteRepository(repo.args)
- }
- }
- if(distInfo.local) {
- localRepository(path:distInfo.local)
- }
- }
+ installOrDeploy(deployFile, ext, true, [remote:repo, local:distInfo.local])
}
catch(e) {
println "Error deploying artifact: ${e.message}"
Please sign in to comment.
Something went wrong with that request. Please try again.