Maven build success with several warnings while downloading dependency from remote repository BitBucket

2.3k views Asked by At

I would like to can download a dependency present on BitBucket remote repository from an another project Maven. To reply the case I've created a remote repository like this: https://bitbucket.org/[user]/mvn-repo

Then, I've created two projects Maven: test and test2 (The project test has only a static method of testing).

Here's test project's POM:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.test</groupId>
    <artifactId>test</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <repositories>
        <repository>
            <id>internal repository</id>
            <url>https://bitbucket.org/[user]/mvn-repo/raw/master/</url>
        </repository>
        <repository>
            <id>Maven Central</id>
            <url>http://repo.apache.maven.org/maven2/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
</project>

while here's test2 project's POM:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.test</groupId>
    <artifactId>test2</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>org.test</groupId>
            <artifactId>test</artifactId>
            <version>0.0.1-SNAPSHOT</version>
        </dependency>
    </dependencies>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <repositories>
        <repository>
            <id>internal repository</id>
            <url>https://bitbucket.org/[user]/mvn-repo/raw/master/</url>
        </repository>
        <repository>
            <id>Maven Central</id>
            <url>http://repo.apache.maven.org/maven2/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
</project>

I've taken the following steps:

  1. Installed the project test on the local repository Maven with command: mvn clean install -DcreateChecksum=true
  2. Copied the project test (as such as org/test/test) from local repository Maven to the folder /git-repo/mvn-repo, then I've pushed on BitBucket remote repository.
  3. Removed folders org/test/test from local repository Maven.
  4. Executed command: mvn clean install -DcreateChecksum=true under the project folder test2.

This is the result

[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------------< org.test:test2 >---------------------------
[INFO] Building test2 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from internal repository: https://bitbucket.org/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/maven-metadata.xml
Progress (1): 1.1 kB
Progress (1): 1.5 kB

[WARNING] Checksum validation failed, expected <html> but is 76a18682367c7eaeca8fb5d2bb5006d22d76280b from internal repository for https://bitbucket.org/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/maven-metadata.xml
Progress (1): 1.1 kB
Progress (1): 1.5 kB
[WARNING] Could not validate integrity of download from https://bitbucket.org/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/maven-metadata.xml: Checksum validation failed, expected <html> but is 3b29c9ec739d87fb529567cc27e22b3d7d5c4feb

[WARNING] Checksum validation failed, expected <html> but is 3b29c9ec739d87fb529567cc27e22b3d7d5c4feb from internal repository for https://bitbucket.org/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/maven-metadata.xml
Downloaded from internal repository: https://bitbucket.org/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/maven-metadata.xml (1.5 kB at 248 B/s)
[WARNING] The metadata C:\Users\[user]\.m2\repository\org\test\test\0.0.1-SNAPSHOT\maven-metadata-internal repository.xml is invalid: unexpected character in markup   (position: START_TAG seen ...t>\nvar elements = document.forms[0].elements;\nfor (var i = 0; i < ... @10:21) 
[WARNING] The metadata C:\Users\[user]\.m2\repository\org\test\test\0.0.1-SNAPSHOT\maven-metadata-internal repository.xml is invalid: unexpected character in markup   (position: START_TAG seen ...t>\nvar elements = document.forms[0].elements;\nfor (var i = 0; i < ... @10:21) 
Downloading from internal repository: https://bitbucket.org/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/test-0.0.1-SNAPSHOT.pom
Progress (1): 1.1 kB
Progress (1): 1.5 kB

[WARNING] Checksum validation failed, expected <html> but is bcb4b6aa3538fce8d8a804e9727bb7866e65681d from internal repository for https://bitbucket.org/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/test-0.0.1-SNAPSHOT.pom
Progress (1): 1.1 kB
Progress (1): 1.5 kB
[WARNING] Could not validate integrity of download from https://bitbucket.org/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/test-0.0.1-SNAPSHOT.pom: Checksum validation failed, expected <html> but is 3546a61a9b568724edfc34f29b202cbafa0e8769

[WARNING] Checksum validation failed, expected <html> but is 3546a61a9b568724edfc34f29b202cbafa0e8769 from internal repository for https://bitbucket.org/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/test-0.0.1-SNAPSHOT.pom
Downloaded from internal repository: https://bitbucket.org/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/test-0.0.1-SNAPSHOT.pom (1.5 kB at 282 B/s)
[WARNING] The POM for org.test:test:jar:0.0.1-SNAPSHOT is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
Downloading from internal repository: https://bitbucket.org/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/test-0.0.1-SNAPSHOT.jar
Progress (1): 1.1 kB
Progress (1): 1.5 kB

[WARNING] Checksum validation failed, expected <html> but is c30cfc686fdc8a1aedb311222b4af1b3b5780e9e from internal repository for https://bitbucket.org/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/test-0.0.1-SNAPSHOT.jar
Progress (1): 1.1 kB
Progress (1): 1.5 kB
[WARNING] Could not validate integrity of download from https://bitbucket.org/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/test-0.0.1-SNAPSHOT.jar: Checksum validation failed, expected <html> but is c0a924f008f5bc6fe27dfc0344e9f18f34e09efb

[WARNING] Checksum validation failed, expected <html> but is c0a924f008f5bc6fe27dfc0344e9f18f34e09efb from internal repository for https://bitbucket.org/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/test-0.0.1-SNAPSHOT.jar
Downloaded from internal repository: https://bitbucket.org/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/test-0.0.1-SNAPSHOT.jar (1.5 kB at 300 B/s)
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ test2 ---
[INFO] Deleting C:\Users\[user]\eclipse-workspace-oxygen\test2\target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ test2 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ test2 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\[user]\eclipse-workspace-oxygen\test2\target\classes
[WARNING] error reading C:\Users\[user]\.m2\repository\org\test\test\0.0.1-SNAPSHOT\test-0.0.1-SNAPSHOT.jar; error in opening zip file
[WARNING] error reading C:\Users\[user]\.m2\repository\org\test\test\0.0.1-SNAPSHOT\test-0.0.1-SNAPSHOT.jar; error in opening zip file
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ test2 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ test2 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ test2 ---
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ test2 ---
[INFO] Building jar: C:\Users\[user]\eclipse-workspace-oxygen\test2\target\test2-0.0.1-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ test2 ---
[INFO] Installing C:\Users\[user]\eclipse-workspace-oxygen\test2\target\test2-0.0.1-SNAPSHOT.jar to C:\Users\[user]\.m2\repository\org\test\test2\0.0.1-SNAPSHOT\test2-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\Users\[user]\eclipse-workspace-oxygen\test2\pom.xml to C:\Users\[user]\.m2\repository\org\test\test2\0.0.1-SNAPSHOT\test2-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.060 s
[INFO] Finished at: 2018-09-14T20:38:42+02:00
[INFO] ------------------------------------------------------------------------

Maven build shows several warnings even if it returns a build success. The file test-0.0.1-SNAPSHOT.jar result be corrupted. How can I resolve the problem?
Thanks for your help in advance.

UPDATE

I've changed the test project's POM for attempting to execute the command mvn deploy -X, however Maven returns the same result:

Downloading from internal repository: https://[email protected]/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/maven-metadata.xml
[WARNING] Checksum validation failed, expected <html> but is d409bb497c4f4faa046afbad1028304f2fc3fcf2 from internal repository for https://[email protected]/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/maven-metadata.xml
[WARNING] Could not validate integrity of download from https://[email protected]/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/maven-metadata.xml
org.eclipse.aether.transfer.ChecksumFailureException: Checksum validation failed, expected <html> but is fe062c89ef7cbebdf7ed304fd17eab147d9b7c5a
    at org.eclipse.aether.connector.basic.ChecksumValidator.validateExternalChecksums (ChecksumValidator.java:174)
    at org.eclipse.aether.connector.basic.ChecksumValidator.validate (ChecksumValidator.java:103)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$GetTaskRunner.runTask (BasicRepositoryConnector.java:456)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run (BasicRepositoryConnector.java:360)
    at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run (RunnableErrorForwarder.java:75)
    at org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute (BasicRepositoryConnector.java:583)

[WARNING] Checksum validation failed, expected <html> but is fe062c89ef7cbebdf7ed304fd17eab147d9b7c5a from internal repository for https://[email protected]/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/maven-metadata.xml
Downloaded from internal repository: https://[email protected]/[user]/mvn-repo/raw/master/org/test/test/0.0.1-SNAPSHOT/maven-metadata.xml (1.5 kB at 248 B/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.473 s
[INFO] Finished at: 2018-09-22T20:37:00+02:00
[INFO] ------------------------------------------------------------------------ 

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project test: Failed to update metadata org.test:test:0.0.1-SNAPSHOT/maven-metadata.xml: Could not parse metadata C:\Users\[user]\.m2\repository\org\test\test\0.0.1-SNAPSHOT\maven-metadata-internal repository.xml: unexpected character in markup   (position: START_TAG seen ...t>\nvar elements = document.forms[0].elements;\nfor (var i = 0; i < ... @10:21)  -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project test: Failed to update metadata org.test:test:0.0.1-SNAPSHOT/maven-metadata.xml: Could not parse metadata C:\Users\[user]\.m2\repository\org\test\test\0.0.1-SNAPSHOT\maven-metadata-internal repository.xml: unexpected character in markup   (position: START_TAG seen ...t>\nvar elements = document.forms[0].elements;\nfor (var i = 0; i < ... @10:21)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)

Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to update metadata org.test:test:0.0.1-SNAPSHOT/maven-metadata.xml: Could not parse metadata C:\Users\[user]\.m2\repository\org\test\test\0.0.1-SNAPSHOT\maven-metadata-internal repository.xml: unexpected character in markup   (position: START_TAG seen ...t>\nvar elements = document.forms[0].elements;\nfor (var i = 0; i < ... @10:21)
    at org.apache.maven.plugin.deploy.DeployMojo.execute (DeployMojo.java:193)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)

Caused by: org.apache.maven.artifact.deployer.ArtifactDeploymentException: Failed to update metadata org.test:test:0.0.1-SNAPSHOT/maven-metadata.xml: Could not parse metadata C:\Users\[user]\.m2\repository\org\test\test\0.0.1-SNAPSHOT\maven-metadata-internal repository.xml: unexpected character in markup   (position: START_TAG seen ...t>\nvar elements = document.forms[0].elements;\nfor (var i = 0; i < ... @10:21)
    at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy (DefaultArtifactDeployer.java:146)
    at org.apache.maven.plugin.deploy.AbstractDeployMojo.deploy (AbstractDeployMojo.java:167)
    at org.apache.maven.plugin.deploy.DeployMojo.execute (DeployMojo.java:157)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)

Caused by: org.eclipse.aether.deployment.DeploymentException: Failed to update metadata org.test:test:0.0.1-SNAPSHOT/maven-metadata.xml: Could not parse metadata C:\Users\[user]\.m2\repository\org\test\test\0.0.1-SNAPSHOT\maven-metadata-internal repository.xml: unexpected character in markup   (position: START_TAG seen ...t>\nvar elements = document.forms[0].elements;\nfor (var i = 0; i < ... @10:21)
    at org.eclipse.aether.internal.impl.DefaultDeployer.upload (DefaultDeployer.java:436)
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy (DefaultDeployer.java:268)
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy (DefaultDeployer.java:223)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy (DefaultRepositorySystem.java:384)
    at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy (DefaultArtifactDeployer.java:142)
    at org.apache.maven.plugin.deploy.AbstractDeployMojo.deploy (AbstractDeployMojo.java:167)
    at org.apache.maven.plugin.deploy.DeployMojo.execute (DeployMojo.java:157)

Caused by: org.eclipse.aether.RepositoryException: Could not parse metadata C:\Users\[user]\.m2\repository\org\test\test\0.0.1-SNAPSHOT\maven-metadata-internal repository.xml: unexpected character in markup   (position: START_TAG seen ...t>\nvar elements = document.forms[0].elements;\nfor (var i = 0; i < ... @10:21)
    at org.apache.maven.repository.internal.MavenMetadata.read (MavenMetadata.java:108)
    at org.apache.maven.repository.internal.MavenMetadata.merge (MavenMetadata.java:74)
    at org.eclipse.aether.internal.impl.DefaultDeployer.upload (DefaultDeployer.java:432)
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy (DefaultDeployer.java:268)
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy (DefaultDeployer.java:223)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.deploy (DefaultRepositorySystem.java:384)
    at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy (DefaultArtifactDeployer.java:142)
    at org.apache.maven.plugin.deploy.AbstractDeployMojo.deploy (AbstractDeployMojo.java:167)

Caused by: org.codehaus.plexus.util.xml.pull.XmlPullParserException: unexpected character in markup   (position: START_TAG seen ...t>\nvar elements = document.forms[0].elements;\nfor (var i = 0; i < ... @10:21)
    at org.codehaus.plexus.util.xml.pull.MXParser.nextImpl (MXParser.java:1523)
    at org.codehaus.plexus.util.xml.pull.MXParser.next (MXParser.java:1317)
    at org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader.checkUnknownElement (MetadataXpp3Reader.java:145)
    at org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader.parseMetadata (MetadataXpp3Reader.java:676)
    at org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader.read (MetadataXpp3Reader.java:954)
    at org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader.read (MetadataXpp3Reader.java:557)
    at org.apache.maven.repository.internal.MavenMetadata.read (MavenMetadata.java:100)
    at org.apache.maven.repository.internal.MavenMetadata.merge (MavenMetadata.java:74)
    at org.eclipse.aether.internal.impl.DefaultDeployer.upload (DefaultDeployer.java:432)
    at org.eclipse.aether.internal.impl.DefaultDeployer.deploy (DefaultDeployer.java:268)

[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
1

There are 1 answers

5
DaviM On

try this on your pom:

<properties>
    <bitBucketUser>${user}</bitBucketUser>
</properties>

<repositories>
    <repository>
        <id>internal repository</id>
        <url>https://bitbucket.org/${bitBucketUser}/mvn-repo/raw/master/</url>
    </repository>
    <repository>
        <id>Maven Central</id>
        <url>http://repo.apache.maven.org/maven2/</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>

and then execute your clean install mvn clean install -Duser=yourBitBucketUser