Reputation: 45
I set up Nexus on my server (api.lielamar.com) and uploaded my first project called PacketManager. You can view it here: https://api.lielamar.com/#browse/browse:maven-public
For some reason, when I try to import it through pom.xml it just doesn't work. I am fairly new to Maven and extremely new to Nexus so it might be a newbie question. I tried using google and couldn't find a direct answer that worked for me.
There's my code:
<repositories>
<repository>
<id>lielamar-repo</id>
<url>https://api.lielamar.com/service/rest/repository/browse/maven-public/</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.lielamar.packetmanager</groupId>
<artifactId>PacketManager</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
I am also using the spigot repository which is working just fine. This is what I see on the IDE
Thank you for your time!
Edit: One of the problems were that I had my dependency calling a different repo when running mvn install or trying to compile through intellij. After adding the following code to setting.xml, I started getting a different error:
<mirrors>
<mirror>
<id>lielamar-mirror</id>
<name>lielamar mirror</name>
<url>https://api.lielamar.com/service/rest/repository/browse/maven-public/</url>
<mirrorOf>lielamar-api</mirrorOf>
</mirror>
</mirrors>
The error I was getting after adding the above code was:
[ERROR] Failed to execute goal on project TestPlugin:
Could not resolve dependencies for project com.lielamar.testplugin:TestPlugin:jar:1.0:
Failure to find com.lielamar.packetmanager:PacketManager:jar:1.0 in
https://api.lielamar.com/service/rest/repository/browse/maven-public/ was cached in the local repository,
resolution will not be reattempted until the update interval of lielamar-mirror has elapsed or updates are forced -> [Help 1]`
I run the command mvn dependency:purge-local-repository
from the cmd and it was built successfully, however, intellij still gives me an error: https://prnt.sc/unxppz
Upvotes: 0
Views: 2272
Reputation: 72
Replace your repository url by https://api.lielamar.com/repository/maven-releases/
The one you have points to a group, if you check on nexus.
The group one might need to be referenced in a different way if they can be referenced at all.
or you might need something like this https://docs.gitlab.com/ee/user/packages/maven_repository/#group-level-maven-endpoint
<repositories>
<repository>
<id>gitlab-maven</id>
<url>https://gitlab.com/api/v4/groups/GROUP_ID/-/packages/maven</url>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>gitlab-maven</id>
<url>https://gitlab.com/api/v4/projects/PROJECT_ID/packages/maven</url>
</repository>
<snapshotRepository>
<id>gitlab-maven</id>
<url>https://gitlab.com/api/v4/projects/PROJECT_ID/packages/maven</url>
</snapshotRepository>
</distributionManagement>
Upvotes: 0
Reputation: 378
It looks ok to me. Have you checked the docs? Perhaps you need to set up Maven first. To make sure it is a Maven issue, also try running your Maven build from outside of Intellij -- just a common practice, as I doubt it is the case that Intellij has anything to do with it.
Upvotes: 0
Reputation: 148
You need to add in your pom.xml
<distributionManagement>
<snapshotRepository>
<repository>
<id>you-repository-name</id>
<url>http://you-repository-url</url>
</repository>
<snapshotRepository>
</distributionManagement>
Upvotes: 0
Reputation: 35795
Your JAR files in the Nexus end with ..jar
, so you probably made a mistake when uploading them (two dots instead of one).
Upvotes: 2