Why aren't my dependencies written into the exported pom.xml?

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.

You’re adding your dependencies to the archives configuration, while what you probably want is the compile configuration. Change your dependencies to read more list this:

dependencies
{
    compile (group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: '2.4+')
    compile (group: 'ch.qos.logback', name: 'logback-classic', version: '1.1+')
    compile (group: 'net.sf.trove4j', name: 'trove4j', version: '3.+')
}

That didn’t solve anything. Please note, that i do only apply the maven plugin to be able to use the pom object (and not the java plugin or anything else). That also means, that i have to create the compile configuration by myself - i also tried it with a configuration with the name ‘runtime’. That didn’t work either.

Kind regards.