Skip to content

Commit 66a88ff

Browse files
author
R. Tyler Croy
authored
Merge pull request #272 from joankaradimov/fix-manifest-issue
Allow manifest attributes to coexist with Main-Class
2 parents 20f2c93 + 89e510e commit 66a88ff

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

jruby-gradle-jar-plugin/src/main/groovy/com/github/jrubygradle/jar/JRubyJar.groovy

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,7 @@ class JRubyJar extends Jar {
213213
exclude 'META-INF/maven/**/pom.xml'
214214
}
215215

216-
manifest = project.manifest {
217-
attributes 'Main-Class': mainClass
218-
}
216+
manifest.attributes 'Main-Class': mainClass
219217
}
220218

221219
if (scriptName != Type.RUNNABLE && scriptName != Type.LIBRARY) {

jruby-gradle-jar-plugin/src/test/groovy/com/github/jrubygradle/jar/JRubyJarPluginSpec.groovy

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,18 @@ class JRubyJarPluginSpec extends Specification {
126126
jarTask.manifest.attributes.'Main-Class' == 'org.scooby.doo.snackMain'
127127
}
128128

129+
def "Adding a main class and additional manifest attributes"() {
130+
when: "Setting a main class"
131+
project.configure(jarTask) {
132+
mainClass 'org.scooby.doo.snackMain'
133+
manifest.attributes('Class-Path': 'gangway.jar zoinks.jar')
134+
}
135+
jarTask.applyConfig()
136+
137+
then: "Then the Main-Class attribute does not erase other attributes"
138+
jarTask.manifest.attributes.'Class-Path' == 'gangway.jar zoinks.jar'
139+
}
140+
129141
def "Setting up a java project"() {
130142
given: "All jar, java plugins have been applied"
131143
project = setupProject()

0 commit comments

Comments
 (0)