Overwriting files in a jar

View: New views
1 Messages — Rating Filter:   Alert me  

Overwriting files in a jar

by Steven Devijver-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
Hey all,

I'm experiencing difficulties in overwriting files in a jar. To give you an idea of the issue have look at the screenshot below:


As you can see the files I'm trying to overwrite end up twice in the jar file which is somewhat surprising. Is this a quirk of the tool I'm using to open the jar (7zip)?

This is the relevant section of my build file:

task moduleJar(type: Jar) {
destinationDir = project.file('build/jar_for_module')
baseName = project.name
dependsOn project.configurations.moduleJar.buildDependencies
}

moduleJar.doFirst {
task ->
for (jar in task.project.configurations.moduleJar) {
task.from zipTree(jar)
}
def jarContentDir = task.project.file('../../jarcontent/' + task.project.name)
if (jarContentDir.exists()) {
def jarContentBuild = task.project.file('build/jarcontent/META-INF')
jarContentBuild.mkdirs()
task.project.copy {
from jarContentDir
into jarContentBuild
}
task.from task.project.fileTree('build/jarcontent')
}
}

Thanks for your help

Steven