Reputation: 127
I was trying to build a jar file. Basically trying to dockerize my project. But I was unable to create a jar file. I was getting error.
While I was running ./gradlew build
I was getting the error:
l (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.code to unnamed module @0x7fd2416f
So, I ran gradle --stacktrace
, then the following reason of error showed up:
e=log4j-api, version=2.14.1}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
plugins {
id 'org.springframework.boot' version '2.5.2'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'org.projects'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '15'
def versionLog4j = '2.14.1'
def versionLombok = '1.18.20'
repositories {
mavenCentral()
}
dependencies {
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: versionLog4j
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: versionLog4j
compile group: 'org.projectlombok', name: 'lombok', version: versionLombok
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: versionLombok
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
runtimeOnly 'org.postgresql:postgresql'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}
java 16.0.1 2021-04-20
Java(TM) SE Runtime Environment (build 16.0.1+9-24)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.1+9-24, mixed mode, sharing)
------------------------------------------------------------
Gradle 7.1.1
------------------------------------------------------------
Build time: 2021-07-02 12:16:43 UTC
Revision: 774525a055494e0ece39f522ac7ad17498ce032c
Kotlin: 1.4.31
Groovy: 3.0.7
Ant: Apache Ant(TM) version 1.10.9 compiled on September 27 2020
JVM: 16.0.1 (Oracle Corporation 16.0.1+9-24)
OS: Windows 10 10.0 amd64
Additionally, I have a warning which I can not fix: Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Upvotes: 2
Views: 1256
Reputation: 1
Instead of
dependencies {
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: versionLog4j
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: versionLog4j
}
use:
dependencies {
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.14.1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.14.1'
}
Upvotes: 0
Reputation: 76
Can You Run the Gradle build with a command line argument --warning-mode=all to see what exactly the deprecated features were used in your build ?
Upvotes: 1