Dependency not found, works in maven

I’m having some trouble adding this library as a dependency in gradle: https://bitbucket.org/JamMaster/commandler/overview, it works it I try to add it in a maven project.

The (working) pom.xml looks like this:

<project ...>
    ...

    <repositories>
        <repository>
            <id>spinalcraft-repo</id>
            <url>http://maven.spinalcraft.com</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.jam.commandler</groupId>
            <artifactId>Commandler</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>
</project>

My attempt at the equivalent build.gradle, but it doesn’t work:

...

repositories {
    mavenCentral()
    maven { url = "http://maven.spinalcraft.com"  }
}

dependencies {
    compile "com.jam.commandler:Commandler:1.0.0"
}

The gradle error message:

Warning:<i><b>root project 'tipsplugin': Unable to build Kotlin project configuration</b>
Details: java.lang.reflect.InvocationTargetException: null
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':compileClasspath'.
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.jam.commandler:Commandler:1.0.0.
Required by:
    project :
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.jam.commandler:Commandler:1.0.0.
Caused by: org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MetaDataParseException: Could not parse POM C:\Users\Karel\.m2\repository\com\jam\commandler\Commandler\1.0.0\Commandler-1.0.0.pom
Caused by: org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.</i>

Warning:<i><b>root project 'tipsplugin': Unable to build Kotlin project configuration</b>
Details: java.lang.reflect.InvocationTargetException: null
Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':compileClasspath'.
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.jam.commandler:Commandler:1.0.0.
Required by:
    project :
Caused by: org.gradle.internal.resolve.ModuleVersionResolveException: Could not resolve com.jam.commandler:Commandler:1.0.0.
Caused by: org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.MetaDataParseException: Could not parse POM C:\Users\Karel\.m2\repository\com\jam\commandler\Commandler\1.0.0\Commandler-1.0.0.pom
Caused by: org.xml.sax.SAXParseException: The markup in the document preceding the root element must be well-formed.</i>

There’s a SaxParseException, I’m guessing that the com.jam.commandler:Commandler:1.0.0 pom.xml (or perhaps a parent/bom) is not well formed xml

The markup in the document preceding the root element must be well-formed.

Possibly there’s a newline or a comment before the <project>?

Their pom.xlm looks okay to me, what do you mean with a parent pom?

Some poms have

<project>
   <parent>... </parent>

Others have

<dependencyManagement>
   <dependency>
      <scope>import</scope>
      ...
   </dependency>

I believe all of these will be visited as part of determining the “effective pom”. So non well-formed xml in any of these poms could be the source of the exception

Hmm, how would I find out where exactly the problem is? Maven itself just seems to accept it and gradle doesn’t really give a lot of information.

Can you post C:\Users\Karel\.m2\repository\com\jam\commandler\Commandler\1.0.0\Commandler-1.0.0.pom?

Perhaps try running it through a SAX parser yourself. I’m guessing there’s some garbage in that file

Is there any more detail in the stack trace? Perhaps a line number in the xml?

This is that file: https://pastebin.com/KVLEExrj

Looks like the host is broken, it returns a website instead of the actual pom.xml file. I’ll contact the author of the library.

Thanks for the help!