mguymon / lock_jar

LockJar manages Java Jars for Ruby
http://mguymon.github.io/lock_jar/
Apache License 2.0
46 stars 9 forks source link

Possible to use Maven external plugin #16

Closed ramarnat closed 9 years ago

ramarnat commented 10 years ago

Is it possible to use the maven external plugin as described here? https://code.google.com/p/maven-external-dependency-plugin/

specifically for this use case - installing voltdb

https://forum.voltdb.com/showthread.php?329-Maven-repository-for-client-jars

mguymon commented 10 years ago

So the jar just needs to be downloaded from a url and placed into the local maven repo? That would not be hard, a pom can be created based on the artifact notation (org.voltdb:voltdb:2.7), snag the repo jar, and install it to the local repo using the created pom.

One issue is this allows someone to wreck their local repo if the accidentally install a jar to the wrong artifact. Maybe add a check that the new jar doesnt exist in the defined Maven repos, with an option to force the install.

Just have to update the DSL to support it, something along the lines of this (not that thrilled with the name manual_jar, but cant think of something better. . .)

manual_jar 'org.voltdb:voltdb:2.7', url: 'http://community.voltdb.com/sites/default/files/archive2.7/LINUX-voltdb-2.7.tar.gz'
ramarnat commented 10 years ago

that looks fairly straight forward. I am also trying with the pom command using the xml.

Will maven handle the untarring?

mguymon commented 10 years ago

Ah, didnt notice the .tar.gz. No, Maven will barf if the tar.gz is passed in directly.

So for this to work, it would need to extract the jar. Could go bare bones and yield a block that returns the path of the jar to be installed, something like:

custom_artifact 'org.voltdb:voltdb:2.7' do  
  file = fetch 'http://community.voltdb.com/sites/default/files/archive2.7/LINUX-voltdb-2.7.tar.gz' 
  jar_file = file.extract('some.jar')   
  jar_file
end
ramarnat commented 10 years ago

would it be possible to use a maven plugin like the external one described in the link?

mguymon commented 10 years ago

There is no way to use a Maven plugin directly in LockJar

ramarnat commented 10 years ago

how about thru a pom.xml?

mguymon commented 10 years ago

Triggering a plugin phase from a pom before the jar is install? It might be possible to configure Aether to do that, but it would be a tall order.

ramarnat commented 10 years ago

This is the only thing I found that could bridge things - http://www.jcabi.com/jcabi-aether/

But for now I'll settle for the manual_jar dsl you proposed, I can download, untar and upload to S3 and then use the S3 repo in the Jarfile.

ramarnat commented 10 years ago

how about integrating something like this instead? https://github.com/spring-projects/aws-maven