bnd gradle plugin fails after adding bundles to a repository

pconley

I'm working on an OSGi bundle using bndtools in Eclipse. I just added a new bundle (apache commons logging) to the cnf/localrepo repository, and our CI server is now failing the build:

[Gradle] - Launching build.
[workspace] $ gradle build
:mybundle  : Cannot find /error/com.springsource.org.apache.commons.logging;version=0 Not found in [bnd-cache, Release, Local, Bndtools Hub, /var/lib/jenkins/jobs/myapp/workspace/cnf/nonosgi-repo r/w=true]
Error  : com.springsource.org.apache.commons.logging;version=0 Not found in [bnd-cache, Release, Local, Bndtools Hub, /var/lib/jenkins/jobs/myapp/workspace/cnf/nonosgi-repo r/w=true]

Project names lightly obfuscated just for simplicity.

It appears to me that the gradle plugin doesn't refresh the repository index - if one of my teammates updates from our vcs without refreshing in Eclipse, then they get the same error.

I know bndtools has the org.osgi.impl.bundle.repoindex.cli plugin, but I don't know enough about bndtools or gradle to apply it to my project. I also feel as though either (a) the gradle plugin should refresh the repositories on its own or (b) I'm using the repositories incorrectly.

Is it possible to add a task to our build.gradle that refreshes the indexes before a build?
Should we instead move all our dependencies to an online repository so bnd doesn't need to manage the indexes?

pconley

Should we instead move all our dependencies to an online repository so bnd doesn't need to manage the indexes?

Probably, but for various reasons it's easier in the short-term to continue to use our LocalIndexedRepository.

Is it possible to add a task to our build.gradle that refreshes the indexes before a build?

bndtools' Bundle-Hub repository uses the org.osgi.impl.bundle.repoindex.cli plugin to reindex the repository in its build.gradle. Since I'm not fluent in groovy or gradle, I simply copied its code into cnf/localrepo/build.gradle:

repositories {
  mavenCentral()
}

configurations {
  repoindex
}

dependencies {
  repoindex group: 'biz.aQute.bnd', name: 'org.osgi.impl.bundle.repoindex.cli', version: '3.0.0' 
}

defaultTasks = [':index']

task('index') {
  /* Bundles to index. */
  def bundles = fileTree(projectDir) {
    include '**/*.jar'
    exclude '**/*-latest.jar'
    exclude '.*/'
  }
  doLast {
    javaexec {
      main = '-jar' // first arg must be the jar
      args configurations.repoindex.singleFile
      args '-n', 'Local' // REPO NAME HERE
      args bundles*.absolutePath
    }.assertNormalExitValue()
  }
}

Thanks to BJ Hargrave for pointing me in the direction of Bundle-Hub's scripts.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Adding a custom Gradle plugin to a project

From Dev

Ivy - adding a maven repository fails

From Dev

Configure Gradle's Artifactory plugin to publish to release or snapshot repository

From Dev

How can you override an existing Gradle plugin from a local repository?

From Dev

Unable to push to Git Repository after adding a branch

From Dev

Adding Git Repository to XCode project after creation

From Dev

URL rewrite fails after adding line to htaccess

From Dev

Ionic Cordova IOS build fails after adding media plugin

From Dev

adding callback to plugin, after plugin initialization

From Dev

After update to 0.12 gradle plugin script fails

From Dev

PMD plugin fails after upgrading Sonarqube to 4.5.4

From Dev

No resource found after adding dependency to gradle

From Dev

Gradle build error after adding appium dependency

From Dev

The purpose of updating after adding a ppa repository

From Dev

Upgrading to gradle plugin 3.2.1 and SDK 28 fails

From Dev

The purpose of updating after adding a ppa repository

From Dev

Javascript fails after adding a table to html

From Dev

Unable to push to Git Repository after adding a branch

From Dev

Adding Git Repository to XCode project after creation

From Dev

gradle error DexException after adding facebook library

From Dev

Eclipse Gradle plugin fails to retrieve Gradle distro on fresh Luna install

From Dev

Ping fails after adding route

From Dev

Gradle build error after adding appium dependency

From Dev

Ionic build issue after adding Localnotification plugin

From Dev

Git Plugin for Jenkins Fails to Connect to Repository

From Dev

Sonar service stops after adding a plugin

From Dev

Unable to start the SonarQube after adding a custom plugin

From Dev

Cordova adding plugin fails

From Dev

How to rename bundles generated with gradle workspace plugin

Related Related

  1. 1

    Adding a custom Gradle plugin to a project

  2. 2

    Ivy - adding a maven repository fails

  3. 3

    Configure Gradle's Artifactory plugin to publish to release or snapshot repository

  4. 4

    How can you override an existing Gradle plugin from a local repository?

  5. 5

    Unable to push to Git Repository after adding a branch

  6. 6

    Adding Git Repository to XCode project after creation

  7. 7

    URL rewrite fails after adding line to htaccess

  8. 8

    Ionic Cordova IOS build fails after adding media plugin

  9. 9

    adding callback to plugin, after plugin initialization

  10. 10

    After update to 0.12 gradle plugin script fails

  11. 11

    PMD plugin fails after upgrading Sonarqube to 4.5.4

  12. 12

    No resource found after adding dependency to gradle

  13. 13

    Gradle build error after adding appium dependency

  14. 14

    The purpose of updating after adding a ppa repository

  15. 15

    Upgrading to gradle plugin 3.2.1 and SDK 28 fails

  16. 16

    The purpose of updating after adding a ppa repository

  17. 17

    Javascript fails after adding a table to html

  18. 18

    Unable to push to Git Repository after adding a branch

  19. 19

    Adding Git Repository to XCode project after creation

  20. 20

    gradle error DexException after adding facebook library

  21. 21

    Eclipse Gradle plugin fails to retrieve Gradle distro on fresh Luna install

  22. 22

    Ping fails after adding route

  23. 23

    Gradle build error after adding appium dependency

  24. 24

    Ionic build issue after adding Localnotification plugin

  25. 25

    Git Plugin for Jenkins Fails to Connect to Repository

  26. 26

    Sonar service stops after adding a plugin

  27. 27

    Unable to start the SonarQube after adding a custom plugin

  28. 28

    Cordova adding plugin fails

  29. 29

    How to rename bundles generated with gradle workspace plugin

HotTag

Archive