Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gradle: bundle task type did not handle plain files in configuration #1490

Merged
merged 2 commits into from
Jun 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ package aQute.bnd.gradle

import java.util.Properties
import java.util.jar.Manifest
import java.util.zip.ZipException
import java.util.zip.ZipFile

import aQute.bnd.osgi.Builder
import aQute.bnd.osgi.Constants
Expand Down Expand Up @@ -144,7 +146,16 @@ class BundleTaskConvention {
builder.setJar(archiveCopyJar)

// set builder classpath
def buildpath = project.files(configuration.resolvedConfiguration.resolvedArtifacts.findAll{it.type == 'jar'}*.file)
def buildpath = project.files(configuration.files.findAll { file ->
try {
new ZipFile(file).withCloseable { zip ->
zip.entries() // make sure it is a valid zip file and not a pom
}
} catch (ZipException e) {
return false
}
return true
})
builder.setProperty('project.buildpath', buildpath.asPath)
builder.setClasspath(buildpath as File[])
logger.debug 'builder classpath: {}', builder.getClasspath()*.getSource()
Expand Down
8 changes: 5 additions & 3 deletions biz.aQute.bndlib/src/aQute/bnd/osgi/ZipResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ public static ZipFile build(Jar jar, File file, Pattern pattern) throws ZipExcep
}
}
return zip;
} catch (ZipException ze) {
throw new ZipException(
"The JAR/ZIP file (" + file.getAbsolutePath() + ") seems corrupted, error: " + ze.getMessage());
} catch (ZipException e) {
ZipException ze = new ZipException(
"The JAR/ZIP file (" + file.getAbsolutePath() + ") seems corrupted, error: " + e.getMessage());
ze.initCause(e);
throw ze;
} catch (FileNotFoundException e) {
throw new IllegalArgumentException("Problem opening JAR: " + file.getAbsolutePath());
}
Expand Down