I have the following dependencies in my build.gradle
:
dependencies {
compile 'org.antlr:antlr4-runtime:4.5.1'
compile 'org.slf4j:slf4j-api:1.7.12'
antlr "org.antlr:antlr4:4.5.1"
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
testCompile 'org.codehaus.groovy:groovy-all:2.4.4'
testCompile 'cglib:cglib-nodep:3.1'
testCompile 'org.objenesis:objenesis:2.1'
}
When I use the Maven Publishing plugin to publish my library, it includes both the ANTLR runtime and compile time JARs as dependencies in the generated POM:
<dependencies>
<dependency> <!-- runtime artifact -->
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.5.1</version>
<scope>runtime</scope>
</dependency>
<dependency> <!-- compile time artifact, should not be included -->
<groupId>org.antlr</groupId>
<artifactId>antlr4</artifactId>
<version>4.5.1</version>
<scope>runtime</scope>
</dependency>
</dependencies>
I only want the runtime library to be included in this POM.
The culprit is the antlr
dependency: If I remove this line, the generated POM does not have the compile-time dependency. However, then the build fails.
antlr
config to yourcompile
config somewhere else in your build.gradle. Need to see more of build.gradle. Also why do you have anantlr
config? – Conahantlr
configuration because I am using the Gradle ANTLR plugin – Ethylethylate./gradlew generatePomFileForGraphqlJavaPublication
generates the pom inbuild/publications/graphqlJava/pom-default.xml
– Ethylethylatepom.withxml
in the publication section. – Conahantlr
config tocompileOnly
instead ofcompile
which would fix all of this. copileOnly dependencies don't make it to pom. Aside: Wonder if you can override what the plugin is doing, from your build script. – Conah