Is there a way in gradle to specify a dependency (a jar), and then run that jarfile directly within a task?
Required plugins for adding Gradle dependencies: Maven and Maven Extension. Both plugins are bundled and enabled by default. IntelliJ IDEA lets you add and manage dependencies in your Gradle project. You can add dependencies, and view them in the diagram.
Gradle declares dependencies on JAR files inside your project's module_name /libs/ directory (because Gradle reads paths relative to the build.gradle file). This declares a dependency on version 12.3 of the "app-magic" library, inside the "com.example.android" namespace group.
It means that dependency graph contains multiple dependencies with the same group and module but different versions for e.g. org.
Here is one way:
configurations {
tool
}
dependencies {
tool "some:tool:1.0"
}
task runTool(type: JavaExec) {
main = "some.tool.Main"
classpath configurations.tool
}
If you don't know the main class and/or want to do the equivalent of java -jar
, you need to employ a workaround as described in http://issues.gradle.org/browse/GRADLE-1274.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With