Jeff,

I did find a solution that was acceptable. Using the maven and
application plugins, you can deploy the zip created by the distZip
task. But you also need to remove the transitive dependencies so that
anything that pulls in the zip will not also pull in everything else.
Remember the aim here to package everything inside the zip as a
complete application, so you do not have other dependencies.

So referencing the example below:

First you need to configure maven to deploy the distZip, do this by
using the "artifacts" closure.
To remove the transitive dependencies (or you could also add a new
set), use the "pom*.whenConfigured" closure. In the example below I
have just remove all other dependencies.

Issues:
There seems to be no way to remove the jar artifact configuration
created by the application plugin. The api only seems to allow you to
add dependencies, and the application plugin has no switch to not
create the jar configuration.

This means that when you install your application into your maven
repo, you will still get a jar added as well. If anyone has a solution
here I would like to know.

To reference the zip in another gradle project use the parameter "ext:
'zip'" when trying to retrieve the application from you maven
repository. By default it will look for the jar, which as you cant
prevent it from being installed/deployed, it will be found and give
you strange results.

The only other trick I have used with the application plugin is to
create a copy spec closure for use by the distZip and installApp
tasks. I think it would be nice if the application plugin had this in
the ApplicationPluginConvention because I think in almost all cases
the installed app and dist would use the same copy spec.

Hope this helps,

-Mike




apply plugin: "maven"
apply plugin: "application"

mainClassName = "<fully qualified main class>"

distCopySpec = {
  from jar.outputs.files
  from 'src/main/scripts'
  into('lib') {
    from configurations.runtime
  }
  .. other copy spec statements
}

installApp distCopySpec
distZip distCopySpec


artifacts {
    archives distZip
}

def installer = install.repositories.mavenInstaller

[installer]*.pom*.whenConfigured {pom ->
  // This is to wipe any dependencies, everything is packaged in this
zip anyway!
  pom.dependencies.clear()
}


run {
  def args = []
  args << "-Xdebug"
  args << "-Xnoagent"
  args << "-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n"
  jvmArgs(args)

  systemProperty 'file.encoding', 'UTF8'
}




On Sat, Sep 3, 2011 at 4:07 AM, jkfrench <[email protected]> wrote:
> Mike, did you figure this out? I'm trying to do the same thing.
>
>     Jeff
>
>
> Mike Mills wrote:
>>
>> I have a project that creates a zip of our product as well as a jar.
>>
>> Currently I am using the maven plugin to install the jar into my local
>> repo.
>>
>> Is there a way to install the zip into the local repo?
>>
>> Specifically the zip has no external dependencies, so the installed
>> pom should also have no dependencies listed.
>>
>> I am at a loss on how to configure this....
>>
>
>
> --
> View this message in context: 
> http://gradle.1045684.n5.nabble.com/Maven-install-dist-not-jar-tp4726649p4763344.html
> Sent from the gradle-user mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>    http://xircles.codehaus.org/manage_email
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to