Hi, i have a simple build script that should write a pom.xml with dependencies. However, the dependencies are not contained in the pom. This is probably due to the fact, that the default configuration is written to disk. However, i tried the suggestion from the ‘Example 52.4. Upload of file via SSH’ from the user guide, but this does seem to not work either. Here is the build script plus the written pom that is missing the dependencies:
apply plugin: 'maven'
group = 'my.company'
version = 1.0
repositories {
mavenCentral()
}
dependencies
{
archives (group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.4+')
archives (group: 'ch.qos.logback', name: 'logback-classic', version: '1.1+')
archives (group: 'net.sf.trove4j', name: 'trove4j', version: '3.+')
}
task writePom << {
pom {
configurations = project.configurations
}.writeTo("$projectDir/pom.xml")
}
And the written pom:
<?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>my.company</groupId>
<artifactId>mylib</artifactId>
<version>1.0</version>
</project>
How can i configure the pom to include the three dependencies defined in the ‘archives’ configuration? I already tried a custom configuration name, but that also didn’t work. I also tried to convert the configuration dependencies to maven dependencies, but i didn’t get anywhere near functioning code.
Thx in advance.