Maven file excerpt:
dependencies { compile project(':something:com.example.util') runtime project(':something:com.example.util') } apply plugin: 'maven' task writeNewPom() { doLast { pom { project { } }.writeTo("$buildDir/resources/main/META-INF/maven/${project.group}/${project.name}/pom.xml") } } tasks.jar.dependsOn writeNewPom I would expect that the generated pom.xml has dependencies with scopes compile and runtime, but I'm only getting the compile scope:
<?xml version="1.0" encoding="UTF-8"?> <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>something</groupId> <artifactId>com.example.foo</artifactId> <version>0.0.1</version> <dependencies> <dependency> <groupId>something</groupId> <artifactId>com.example.util</artifactId> <version>0.0.1</version> <scope>compile</scope> </dependency> </dependencies> </project> How do I get both scopes? Or, if I can't, how can I get the runtime scope which is more important for my use case?
<dependency>entries with different scopes for the same artifact make no sense).compileincludesruntime.compilescope artifacts are available for compilation, test and at runtime.runtimeincludescompile. Nice graphic on this and explanations in the docs (scroll down a little for the illustration).