Comments (7)
Gradle does not support optional dependencies in its dependency management, so that information is lost.
Workaround is easy if you know the bundle where you want to make the dependency optional and the respective package names. You can configure the bundle to use optional package imports, similar to the first example here.
from bnd-platform.
Thanks for the quick reply. I tried that, but it's not working, so I must do something wrong. Here is my script:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.standardout:bnd-platform:1.4.0'
}
}
repositories {
mavenCentral()
}
apply plugin: 'org.standardout.bnd-platform'
dependencies {
platform 'commons-logging:commons-logging:1.1.1'
}
platform {
bnd(group: 'commons-logging', name: 'commons-logging') {
optionalImport 'org.apache.avalon.framework.logger'
}
}
And here is the generated manifest:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Build-Jdk: 1.4.2_16
Built-By: dlg01
Bundle-ManifestVersion: 2
Bundle-Name: commons-logging.commons-logging
Bundle-SymbolicName: commons-logging
Bundle-Version: 1.1.1.bnd-u8sQ6Q
Export-Package: org.apache.commons.logging;version="1.1.1",org.apache.co
mmons.logging.impl;version="1.1.1";uses:="javax.servlet,org.apache.aval
on.framework.logger,org.apache.commons.logging,org.apache.log,org.apach
e.log4j"
Extension-Name: org.apache.commons.logging
Implementation-Title: Jakarta Commons Logging
Implementation-Vendor: Apache Software Foundation
Implementation-Vendor-Id: org.apache
Implementation-Version: 1.1.1
Import-Package: javax.servlet,org.apache.avalon.framework.logger,org.apache.log,org.apache.log4j
Originally-Created-By: Apache Maven
Specification-Title: Jakarta Commons Logging
Specification-Vendor: Apache Software Foundation
Specification-Version: 1.0
X-Compile-Source-JDK: 1.2
X-Compile-Target-JDK: 1.2
from bnd-platform.
Strange, the configuration looks alright. Does it make a difference if you use org.apache.avalon.framework.logger.*
or org.apache.avalon.framework.*
for the optional import instruction?
from bnd-platform.
Hmmm, no, it doesn't.
I also tried this as a cross check:
optionalImport 'javax.servlet'
It doesn't have any effect either.
from bnd-platform.
Just copied your build.gradle
and let it run locally, this is the Manifest I get:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Build-Jdk: 1.4.2_16
Built-By: dlg01
Bundle-ManifestVersion: 2
Bundle-Name: commons-logging.commons-logging
Bundle-SymbolicName: commons-logging
Bundle-Version: 1.1.1.bnd-5zkmsg
Export-Package: org.apache.commons.logging;version="1.1.1",org.apache.co
mmons.logging.impl;version="1.1.1";uses:="javax.servlet,org.apache.aval
on.framework.logger,org.apache.commons.logging,org.apache.log,org.apach
e.log4j"
Extension-Name: org.apache.commons.logging
Implementation-Title: Jakarta Commons Logging
Implementation-Vendor: Apache Software Foundation
Implementation-Vendor-Id: org.apache
Implementation-Version: 1.1.1
Import-Package: org.apache.avalon.framework.logger;resolution:=optional,
javax.servlet,org.apache.log,org.apache.log4j
Originally-Created-By: Apache Maven
Specification-Title: Jakarta Commons Logging
Specification-Vendor: Apache Software Foundation
Specification-Version: 1.0
X-Compile-Source-JDK: 1.2
X-Compile-Target-JDK: 1.2
So everything seems to work fine. Maybe an issue with the Gradle version? I just used Gradle 2.4, after that I tried it with Gradle 3.1, with the same result.
from bnd-platform.
Strange though that the hash is different than yours - this would hint at a different configuration. Did you maybe look into an old Jar?
Maybe also run the clean task, e.g. gradle clean updateSite
from bnd-platform.
I deleted ~/.groovy, ~/.gradle, killed all daemons etc., and now it works as expected, both with Gradle 2.9 that I used in the first place, and 3.1. So I guess something was wrong with my environment. Strangely enough, I had the same symptoms on my Mac and on a Windows PC. I fixed it on my Mac, I will check on Windows on monday.
During the many trials and errors, I also had an error message during the Eclipse download like the one in this bug report:
michel-kraemer/gradle-download-task#47
It's gone now. It was also probably due to environment/caches, maybe it's related to the original issue I had.
Feel free to close the issue. Thanks again for your help.
from bnd-platform.
Related Issues (20)
- create eclipse plugin HOT 2
- Support for Gradle 3/4 HOT 3
- Create 1.6 release and publish 1.7 snapshot? HOT 4
- "Could not retrieve POM" spam HOT 2
- SSL issues with cloudfront.net when trying to download Eclipse HOT 4
- Avoid 'Require-Capability' header? HOT 2
- Generated update site does not work HOT 3
- OptionalImport not working HOT 2
- feature.xml does not contain all dependencies HOT 2
- Setting buildDir does not work HOT 2
- fetchSources = true adds source bundles to feature HOT 11
- Getting java.util.NoSuchElementException on updateSite goal HOT 3
- Generated updatesite not working due to missing filters HOT 2
- Gradle 6 Incompatibility HOT 8
- extracting Bundle-License from pom.xml does not work HOT 1
- Not all bundles are downloaded HOT 2
- Default location of eclipseMirror no longer available HOT 7
- Add new releases to Gradle Plugin Portal HOT 1
- bndtools < 5.3 may create invalid ZIP file extra fields (jar loading exceptions with recent JRE versions) HOT 5
- Dependency Dashboard
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bnd-platform.