Search code examples
javamavenmaven-2maven-3

Error while reading JAR from my Remote Repository [Dropbox as Maven Repository]


So I created my own remote repository with Dropbox following this tutorial. Further, I used the following command to deploy 3rd party JARS to my repository.

mvn deploy:deploy-file -DgroupId=com.prowritingaid.java -DartifactId=pro_writing_aid_java -Dversion=2.0.0 -Dpackaging=jar -Dfile=pro_writing_aid_java-2.0.0.jar -Durl=file:/home/de-10/Dropbox/ProWritingAid

The deployment was successful and it successfully synchronised with Dropbox as well. But now when I try to refer to these jars via pom.xml, it isn't working.

I added the Dropbox URL to my repositories list:

        <repository>
            <id>ProWritingAid</id>
            <name>Remote ProWritingAid Repository</name>
            <url>https://www.dropbox.com/sh/fbv...</url>
        </repository>

and I've defined the dependencies like:


        <!-- Keshavram Kuduwa's Dropbox Repository -->
        <dependency>
            <groupId>com.prowritingaid.java</groupId>
            <artifactId>pro_writing_aid_java</artifactId>
            <version>2.0.0</version>
        </dependency>

        <!-- Keshavram Kuduwa's Dropbox Repository -->
        <dependency>
            <groupId>com.squareup.okhttp3</groupId>
            <artifactId>logging-interceptor</artifactId>
            <version>2.7.5</version>
        </dependency>

The compile-time error is:

Description Resource Path Location Type Archive for required library: '/home/de-10/.m2/repository/com/prowritingaid/java/pro_writing_aid_java/2.0.0/pro_writing_aid_java-2.0.0.jar' in project 'papertrue' cannot be read or is not a valid ZIP file papertrue Build path Build Path Problem

But on the other hand, when I install these packages locally with the following, it works:

mvn install:install-file -DgroupId=com.prowritingaid.java -DartifactId=pro_writing_aid_java -Dversion=2.0.0 -Dpackaging=jar -Dfile=pro_writing_aid_java-2.0.0.jar

Moreover, if I delete these locally installed packages and force update the project, the error shows up again. I also replaced the JAR in the remote repository but it didn't help.


Solution

  • The Jar I was deploying didn't have a pom.xml file and hence the error. I tried something different, to use an in-project repository -> Creating an In-Project Maven Repository and deploying 3rd party JARs to it.