bndtools / bnd

Bnd/Bndtools. Tooling to build OSGi bundles including Eclipse, Maven, and Gradle plugins.
https://bndtools.org
Other
532 stars 305 forks source link

gradle : ClassNotFoundException: aQute.bnd.build.Project #3125

Closed btpka3 closed 5 years ago

btpka3 commented 5 years ago

ClassNotFoundException: aQute.bnd.build.Project

Just following the doc of gralde plugin biz.aQute.bnd.builder with java 1.8.0_151 ,gradle 5.3.1, reported “java.lang.ClassNotFoundException: aQute.bnd.build.Project”。

But after add "biz.aQute.bnd:biz.aQute.bndlib:4.2.0" to "buildscript/dependencies", then it works:

buildscript {
    dependencies {
        classpath "biz.aQute.bnd:biz.aQute.bnd.gradle:4.2.0"
        classpath "biz.aQute.bnd:biz.aQute.bndlib:4.2.0"           // added 
    }
}

Please update the doc, or add biz.aQute.bnd:biz.aQute.bndlib as dependency for biz.aQute.bnd:biz.aQute.bnd.gradle

bjhargrave commented 5 years ago

That should not be necessary as the biz.aQute.bnd.gradle jar expresses it dependency on biz.aQute.bndlib in its pom. I use biz.aQute.bnd.gradle successfully in many places without having to also add biz.aQute.bndlib to the buildscript classpath. For example, the build of this very project.

Can you please provide a small github repo which demonstrates the problem? Then we can investigate. Thanks.

btpka3 commented 5 years ago

When preparing the demo. I found it works . reason: I only configured 4 repo in settings.gradle, but not configured any repo in build.gradle's buildscript/repositories

// settings.gradle
pluginManagement {
    repositories {
        mavenLocal()
        gradlePluginPortal()
        maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
        mavenCentral()
    }
}

after config build.gradle, then it works:

// build.gradle
buildscript {
    repositories {   // config some remote repo, then ok
        maven { url "http://maven.aliyun.com/nexus/content/groups/public/" }
        mavenCentral()
    }
}

plugins {
    id 'java'
    id "biz.aQute.bnd.builder" version "4.2.0"
}
Vampire commented 5 years ago

This probably was because of #3174