Answer the question
In order to leave comments, you need to log in
How to solve the problem with missing main class error?
Hello.
Wrote a Java class to connect to Hive and made a task to build
task Hive(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': version,
'Main-Class': 'ru.prometheus.nodeexporters.Hive'
}
baseName = project.name + '-Node_Exporter'
// from('src/main/java') {
// include 'resources/*'
// }
from {
configurations.runtime.collect {
it.isDirectory() ? it : zipTree(it)
}
}
with jar
}
12:55:46: Executing task 'Hive'...
> Task :Hive:compileJava
Note: C:\Servers\Repository\PrometheusNodeExporters\Hive\src\main\java\ru\prometheus\nodeexporters\Hive.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Servers\Repository\PrometheusNodeExporters\Hive\src\main\java\ru\prometheus\nodeexporters\Hive.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
> Task :Hive:processResources
> Task :Hive:classes
> Task :Hive:Hive
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD SUCCESSFUL in 26s
3 actionable tasks: 3 executed
12:56:13: Task execution finished 'Hive'.
Answer the question
In order to leave comments, you need to log in
the problem was that when adding well-defined dependencies, in particular
, LIST files are added and the JVM begins to experience difficulties in determining the main classes
, therefore, in the task, to solve this problem, you need to add:
exclude("META-INF/*.LIST","META-INF/*.SF","META-INF/*.DSA","META-INF/*.RSA")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question