0

I build the common projects and install it to local repository and then I try to use the same jar package but computer cannot find it.

Firstly, I build and install common into my local repository:

F:\seprate\paymate-commons>mvn -DskipTests install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building paymate-commons 2.6.9
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ paymate-commons ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory F:\seprate\paymate-commons\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ paymate-commons ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ paymate-commons ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ paymate-commons ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.16:test (default-test) @ paymate-commons ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ paymate-commons ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ paymate-commons ---
[INFO] Installing F:\seprate\paymate-commons\target\paymate-commons-2.6.9.jar to C:\Users\Lu Sheng\.m2\repository\au\com\paymate\paymate-commons\2.6.9\paymate-commons-2.6.9.jar
[INFO] Installing F:\seprate\paymate-commons\pom.xml to C:\Users\Lu Sheng\.m2\repository\au\com\paymate\paymate-commons\2.6.9\paymate-commons-2.6.9.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.841 s
[INFO] Finished at: 2016-07-28T10:18:01+10:00
[INFO] Final Memory: 11M/155M
[INFO] ------------------------------------------------------------------------

After that I try to build paymate-model which is depending on paymate-commons

F:\seprate\paymate-model>mvn -o -DskipTests install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building paymate-model 2.6.9
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.944 s
[INFO] Finished at: 2016-07-28T10:21:22+10:00
[INFO] Final Memory: 7M/123M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project paymate-model: Could not resolve dependencies for project au.com.paymate:paymate-model:jar:2.6.9: Failed to collect dependencies at au.com.paymate:paymate-commons:jar:2.6.9: Failed to read artifact descriptor for au.com.paymate:paymate-commons:jar:2.6.9: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact au.com.paymate:projects:pom:2.6.9 has not been downloaded from it before. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[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/DependencyResolutionException

I find no mate I use mvn -DskipTests install or mvn -DskipTests install I do not use the local repositry But I can find jar file in default local repositry.

C:\Users\Username\.m2\repository\au\com\paymate\paymate-commons\2.6.9

How to make computer know the jar position and use it? Do I need to do some setting on pom.xml?

user504909
  • 9,119
  • 12
  • 60
  • 109
  • 1
    Can you provide more details on the **pom.xml** that you are using? In the last error message it says "_...the artifact au.com.paymate:*projects*:pom:2.6.9 has not been downloaded..._" which is not the same artifact you have previously installed. – Gonzalo Matheu Jul 28 '16 at 00:52
  • I don't understand this: _I find no mate I use **mvn -DskipTests install** or **mvn -DskipTests install** I do not use the local repositry But I can find jar file in default local repositry._ – JimHawkins Jul 28 '16 at 07:17

3 Answers3

0

You need to do some setting on setting.xml (not pom.xml)! Find your maven directory, and edit conf/setting.xml. Find <localRepository> node, write your .jar file directory!

R. Zagórski
  • 20,020
  • 5
  • 65
  • 90
Kevinsss
  • 754
  • 7
  • 7
0

There are couple of options you can try.

  1. Clean au.com.paymate folder and re-run the payment-commons with

    mvn -U clean install

    and then run you you payment-model

  2. Give the dependency with absolute path

Community
  • 1
  • 1
kuhajeyan
  • 10,727
  • 10
  • 46
  • 71
0

As Gonzalo Matheu pointed out, you are missing the dependency

au.com.paymate:projects:pom:2.6.9

Following the name, it should be part of the project. Maybe you are building just one module of a larger project? Or you forgot to create another related project first?

In any case, the build fails because au.com.paymate:projects:pom:2.6.9 is not in your local repository, so either you have to get it from another repository or you have to build it yourself from a related project.

J Fabian Meier
  • 33,516
  • 10
  • 64
  • 142