[Solved] Maven-publish does not generate POM with dependencies


(Scott Palmer) #1

Gradle Version: 2.14.1
Operating System: Windows 10
Is this a regression? If yes, which version of Gradle do you know it last worked for?

apply plugin: 'java'
apply plugin: 'maven-publish'

version = '1.0'
group = 'example.company'

sourceCompatibility = '1.8'
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'

repositories {

dependencies {
    testCompile group: 'junit', name: 'junit', version: '4.10'
    compile group: 'commons-lang', name: 'commons-lang', version: '2.4'

publishing {
	publications {
		main(MavenPublication) {
	            artifact jar

run: gradle generatePomFileForMainPublication

$ cat build\publications\main\pom-default.xml

<?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"

Where is the dependency on commons-lang???

(Scott Palmer) #2

I now understand the problem. I must use “from components.java” (not just components.java) so the dependency information is there. Using ‘archive jar’ it appears to be treated as a plain file with no dependency information.