Skip to content

Commit

Permalink
build.gradle: don't use withSourcesJar()---it adds resources to the JAR
Browse files Browse the repository at this point in the history
  • Loading branch information
stephengold committed May 19, 2024
1 parent 5e14900 commit db18f72
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ java {
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_8
withJavadocJar()
withSourcesJar()
}

dependencies {
Expand Down Expand Up @@ -71,6 +70,13 @@ jar {
}
}

tasks.register('sourcesJar', Jar) {
archiveBaseName = project.ext.baseName
archiveClassifier = 'sources'
description 'Creates a JAR of Java sourcecode.'
from sourceSets.main.allJava // default is ".allSource", which include resources
}

assemble.dependsOn('module', 'moduleAsc', 'pom', 'pomAsc')
tasks.register('module', Copy) {
dependsOn 'generateMetadataFileForMavenPublication'
Expand Down Expand Up @@ -104,6 +110,7 @@ tasks.register('pomAsc', Copy) {
publishing {
publications {
maven(MavenPublication) {
artifact sourcesJar
artifactId artifact
from components.java
groupId project.ext.group
Expand Down

0 comments on commit db18f72

Please sign in to comment.