Needing help to get local directory structure working as repository


(Scott Duchin) #1

i have a simple directory structure with jars the pattern is [module]/[version]/[module]-[version].jar i can get files() to work but not the “compile ‘joda-time:joda-time:2.3’” to work would appreciate some help i do not have any xml files in this structure – just the jars

...
    def repositoryThirdParty = "file:///local_directory/third_party/java"
    repositories {
    ivy {
      url repositoryThirdParty
//
  layout "pattern", {
                        <---- tried some approaches with this but no success
//
    artifact "[module]/[revision]/[module]-[revision].jar"
//
    m2compatible = true
//
  }
    }
  }
    dependencies {
//
 compile files(
                               <-- this does work but hoping to get repository working
//
   "local_directory/third_party/java/joda-time/2.3/joda-time-2.3.jar"
//
 )
    compile 'joda-time:joda-time:2.3'
     <-- this fails
  }
  ...

error i get is:

  • What went wrong: Could not resolve all dependencies for configuration ‘:compile’. > Could not find joda-time:joda-time:2.3.

Required by:

:example:unspecified


(Scott Duchin) #2

so we got a lot further with the code below, not sure this is the only way to do what we are trying to but this seems okay the only problem is that we do not know how to bring in the twelve (or selected) jars from the guice 4.0-beta release once again the code below is working but not desired as something like the commented code looks cleaner

def repositoryGoogle = "file://local_directory/google/java/"
  def repositoryThirdParty = "file://local_directory/third_party/java/"
  def ivyPattern = "[module]/v[revision]/[artifact](-[classifier])(-[revision]).[ext]"
    repositories {
    add(new org.apache.ivy.plugins.resolver.URLResolver()) {
      name = 'localGoogleRepo'
      addIvyPattern repositoryGoogle + ivyPattern
      addArtifactPattern repositoryGoogle + ivyPattern
    }
    add(new org.apache.ivy.plugins.resolver.URLResolver()) {
      name = 'localThirdPartyRepo'
      addIvyPattern repositoryThirdParty + ivyPattern
      addArtifactPattern repositoryThirdParty + ivyPattern
    }
  }
    dependencies {
    compile ':guava:14.0.1'
//
  compile (':guice:4.0-beta') {
//
    artifact
{ name='guice'; type='jar' }
//
    artifact
{ name='javax.inject'; type='jar' }
//
  }
    compile group: 'guice', name: 'guice', version: '4.0-beta'
//
  compile group: 'guice', name: 'javax.inject', version: '4.0-beta'
    compile files(
      "$System.env.STORM_HOME/motorola1/google/java/guice/v4.0-beta/javax.inject.jar"
    )
    compile ':joda-time:2.3'
    testCompile ':junit:4.11'
    testCompile ':mockito:1.9.5:all'
...