8

I would like to include in gemspec 'jar dependencies' that are local such as

/opt/someplugin/lib/somejar.jar

Currently the only way I found to use a local jar file in a project is within *.rb file by require /opt/someplugin/lib/somejar.jar

It will take a look at snapshot of DynamoDB gemspec using jar dependencies

  # Jar dependencies
  s.requirements << "jar 'com.amazonaws:amazon-kinesis-client', '1.6.0'"
  s.requirements << "jar 'log4j:log4j', '1.2.17'"
  s.requirements << "jar 'com.amazonaws:aws-java-sdk-dynamodb', '1.10.10'"
  s.requirements << "jar 'com.amazonaws:aws-java-sdk-core', '1.10.10'"
  s.requirements << "jar 'com.amazonaws:dynamodb-import-export-tool', '1.0.0'"
  s.requirements << "jar 'commons-logging:commons-logging', '1.1.3'"
  s.requirements << "jar 'com.amazonaws:dynamodb-streams-kinesis-adapter', '1.0.0'"
  s.requirements << "jar 'com.google.guava:guava', '15.0'"
  s.add_runtime_dependency 'jar-dependencies'

What happens is that gem build downloads jar files from maven repository.

I want to achieve the same "effect" BUT with local jars located in my file system.

Example to a command that probably would look like what i need:

caution ?not real? gemspec line: s.requirements << "jar '/opt/someplugin/lib/somejar.jar', '1.0.0"

Thanks for your help.

stark
  • 2,246
  • 2
  • 23
  • 35
Tal.Bary
  • 450
  • 2
  • 16

1 Answers1

0

You can install local jar into local maven repository like described here

For your example a command could be:

mvn install:install-file -Dfile=/opt/someplugin/lib/somejar.jar -DgroupId=some.group -DartifactId=somejar -Dversion=0.0.1 -Dpackaging=jar    

Then in the gemspec you can reference this jar:

# Jar dependencies
s.requirements << "jar 'some.group:somejar', '0.0.1'"
Mike Shauneu
  • 3,201
  • 19
  • 21
  • Thanks I'll try that, My development PC is down right now. I'll try that soon. It looks like a good option. But it looks that you can't just include jar in a gemspec but install it before. – Tal.Bary Feb 24 '16 at 08:57