I am trying to get a jar generated so I can use it as a dependency for a different project.
In the build.gradle, I have defined the maven-publish id and the publishing tasks, but only the following files are generated - but I need the custom-codegen-0.0.1-SNAPSHOT.jar
custom-codegen-0.0.1-SNAPSHOT-plain.jar
custom-codegen-0.0.1-SNAPSHOT.module
custom-codegen-0.0.1-SNAPSHOT.pom
maven-metadata-local.xml
build.gradle
plugins {
id 'org.springframework.boot' version '2.5.6'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
id 'maven-publish'
}
group = 'com.tmo5'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
}
}
repositories {
maven {
def releasesRepoUrl = "$buildDir/repos/releases"
def snapshotsRepoUrl = "$buildDir/repos/snapshots"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}