RESOLVED
P.S.Because I don’t have enough reputation to answer my own question right now so I put the solution in the question.
I just start using Maven with my android project. I use a game engine called libgdx, it’s not in the central repo, so I have to install it by myself.
After check the instruction, I use this method.https://stackoverflow.com/q/2230464/531223.
I add below defined xml code in root pom.xml
<repositories>
<repository>
<id>my-local-repo</id>
<url>file://${basedir}/common/repo</url>
</repository>
</repositories>
And install the jar files I needed successfully with the method in that answer. However, when I execute command mvn install or mvn -o install, it still tell me can’t find the jar file. I’m not sure the repository I added in root pom.xml is working.
Can anyone tell me where I made the mistake and how to check whether the project defined repository is working? Thank you.
Thank you Death, I figured it out, it’s my silly fault.
In my project, I have 3 module. common android and desktop. I use common/repo dir as my repository. That’s why I start use Maven. I did everything is correct except 2 mistake.
1.Put the repository code in root pom.xml not in pom.xml in the android dir which I . I just thought it will works but it isn’t.
2.If I put the code in the right dir, I should modify the url, the basedir is changed.
This lesson cost me 3 hours~
Run mvn help:effective-pom
Look into the
<repositories>section, locate yourmy-local-repoand look up its real path (excluding file:// prefix)run this command (from the link you found yourself)
mvn org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file -Dfile=/path/to/your.jar -DgroupId=yourGroup -DartifactId=yourArtifactId -Dversion=1.0 -Dpackaging=jar -DlocalRepositoryPath=the_path_you_looked_up_excluding_file://if (3) produces errors post them here, if not – make sure that folder
the_path_you_looked_up_excluding_file://contains a subfolder structuregrp/yourArtifactId/1.0/withyour.jarin thereafter all that your project must be able to locate the dependency with this definition