Publish an external jar with generated pom

I have external libraries that I would like to use Gradle to put into a Maven repository. The libraries have dependencies that I have to document in the pom. The pom, however, is only correctly generated with dependencies when I enter “from components.java” in the MavenPublication. Then I have the problem that my library is duplicated and the task fails

def edcJarArtifact = artifacts.add("archives", file("$distributeDir/edc.jar")) {
type "jar"
builtBy "copyEdcJar"
}
def docJarArtifact = artifacts.add("archives", file("$distributeDir/edc-javadoc.jar")) {
type "jar"
classifier "javadoc"
builtBy "copyEdcAddons"
}

publishing {
	repositories {
		maven {
			url new File(buildDir, "maven-repo")
		}
	}
        publications {
		mavenJava(MavenPublication) {
                        //without --> no dependencies in pom; with --> double edc.jar
			from components.java
			//Jar
			//artifact edcJarArtifact
			//JavaDoc
			artifact docJarArtifact
                     }
             }
}