We are using Artifactory 6.17.0 on a Linux Server.
We migrated it to a new server by simply tar'ing the installation directory & un-tar'ing it at exactly the same path in the new machine. This directory contains the entire installation.
Retrieval of local & bincentre objects via Artifactory is working ok using maven & pom.xml in a Java project under eclipse.
Deployments are being rejected as follows:
2022-02-06 14:48:49,779 [http-nio-8081-exec-1] [WARN ] (o.a.r.ArtifactoryResponseBase:125) -
Sending HTTP error code 409:
The repository 'libs-release-local' rejected the resolution of an artifact
'libs-release-local:my/server/0.0.1-SNAPSHOT/securpharm.server-0.0.1-20220206.134849-1.jar'
due to conflict in the snapshot release handling policy.
I have updated the <distributionManagement> in my pom.xml to the suggested values fromt the Artifactory Web Admin:
<distributionManagement>
<repository>
<id>central</id>
<name>servername-releases</name>
<url>http://servername.domain.name.com:8081/artifactory/libs-release</url>
</repository>
</distributionManagement>
Anyone have an idea what the problem might be?
In addtion to the above comment, If you would like to publish both snapshot and release version under the repository "libs-release-local" repository you can select the option "Handle Releases" in the libs-release-local repository configuration page and publish the version. As shown in the screenshot here.
Please note, it is always recommended to have separate repositories for handling release and snapshot version.
We use a nexus repository for our libraries. Another projects has it as a dependency in version 6.1.2-SNAPSHOT, but maven fails to fetch it.
It tries to fetch https://nexus/nexus/repository/snapshots/tld/company/lib/lib-6.1.2-SNAPSHOT.jar but it fails.
When checking manually I can see that there is a https://nexus/nexus/repository/snapshots/tld/company/lib/lib-6.1.2-20220101.111111-11.jar available.
My settings.xml has a repository entry for the snapshots:
<repository>
<id>snapshots</id>
<url>https://nexus/nexus/repository/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
How do I tell Maven to use that instead?
Okay, the issue was resolved.
We had a "clean snapshots task" in Nexus which deleted "old" -- although this one was not that old -- snapshots. We changed the number of kept snapshots and restored the ones missing.
Thanks so far for all suggestions!
Note: Before you mark this as duplicate please check all information as after 4 hours of search I couldn't find any close cases. All results were about Android Library or Gradle which is not correct on this case.
Links:
Build Log: https://jitpack.io/xyz/agmdev/AGMCore/3.3.1/build.log
Github Source: https://github.com/Ashenguard/AGMCore
Error:
Exit code: 0
Timed out after 20 min
ERROR: No build artifacts found
Project: Maven - Spigot
Version: 3.3.1
Today after finishing the coding, compiling, testing (All of them were successful on my PC) I decided it's time to upload it on Github and create the 3.3.1 release on jitpack.io so I or any other developer can use it in further projects as dependency.
Everything was ok until I started the new project depending on the new code I just uploaded.
But I faced the dependency not found on my IDE (Intelij) and I thought it is a connection issue or something similar, But after troubleshooting, I got to the Build being failure on jitpack.io.
Before you ask, I did test mvn install and it worked fine without any issue on my PC, but for some reason that I'm not aware of, jitpack fails...
What confused me more only thing that has been changed on pom.xml since the last successful build, is the version number
Possible issues that were not the issue in this case. (I'll update the list)
Packaging not being jar which was, Same as previous versions.
useIncrementalCompilation was not the issue as well.
This error can happen in multiple scenarios.
Scenario 1:
If the build fails
If there are no pom.xml or .pom files in build directory
If artifacts are not copied to $HOME/.m2/...
Scenario 2:
You can fix it by looking at https://github.com/jitpack/maven-modular
Scenario 3:
Try this jitpack example
Note: You can only solve it by yourself making sure you have double check your poms.
--- Updated --
Workaround:
Try to add JitPack repository and dependency in your pom.xml file:
JitPack repository:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
JitPack dependency:
<dependency>
<groupId>com.github.YourProjectName</groupId>
<artifactId>ID</artifactId>
<version>Tag</version>
</dependency>
Maybe it can fix the issue as you said it only occurs on JitPack.
After months of head-scratching, I found out the issue.
The issue was that Jitpack was not able to find one of the plugins I have used in the project, After adding the maven as a plugin repository the issue is gone and Jitpack is doing its job.
<pluginRepositories>
<pluginRepository>
<id>maven-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots/</url>
</pluginRepository>
<pluginRepository>
<id>maven-shade-plugin</id>
<url>https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-shade-plugin</url>
</pluginRepository>
</pluginRepositories>
I have a dependency in pom on some library.
I want to make some changes in it, test it locally and if it will work fine - deploy it to remote repo.
So I have locally made some changes in this library, installed it as a jar, and want to replace in my main project remote library with the local one.
What is proper way to do it?
You can override default maven repository in project's pom:
<repositories>
<repository>
<id>central</id>
<url>file://d:/repo</url>
</repository>
</repositories>
When resolving dependencies, Maven looks in your local repository ($HOME/.m2/repository). So if you have installed your modified dependency into your local repository (e.g. through mvn install) then when you build your main project, it will be used.
To make this more obvious, you may want to change the versions being used in both the library and your main project POM, so that you can be sure your version is being used for testing.
You may also find this question/answer useful: How do I force Maven to use my local repository rather than going out to remote repos to retrieve artifacts?
Maven first looks in your local repository in
C:\Users\User\.m2\repository
and if it can't find the library, then it looks in remote repos. If I understand your question correctly, this should be happening automatically as long as you point the correct version in the POM.
Does maven require a connection to the internet at some point to be able to use it? Meaning specifically getting the internal maven plugins for compiling, cleaning, packaging, etc?
You can run Maven in "offline" mode using the -o or -offline option (e.g. mvn -o install). Of course any artifacts not available in your local repository will fail. Maven is not predicated on distributed repositories, but they certainly make things more seamless. It's for this reason that many shops use internal mirrors that are incrementally synced with the central repos.
In addition, the mvn dependency:go-offline can be used to ensure you have all of your dependencies installed locally before you begin to work offline.
If you have a PC with internet access in your LAN, you should install a local Maven repository.
I recommend Artifactory Open Source. This is what we use in our organization, it is really easy to setup.
Artifactory acts as a proxy between your build tool (Maven, Ant, Ivy, Gradle etc.) and the outside world.
It caches remote artifacts so that you don’t have to download them over and over again.
It blocks unwanted (and sometimes security-sensitive) external requests for internal artifacts and controls how and where artifacts are deployed, and by whom.
After setting up Artifactory you just need to change Maven's settings.xml in the development machines:
<?xml version="1.0" encoding="UTF-8"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<mirrors>
<mirror>
<mirrorOf>*</mirrorOf>
<name>repo</name>
<url>http://maven.yourorganization.com:8081/artifactory/repo</url>
<id>repo</id>
</mirror>
</mirrors>
<profiles>
<profile>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>libs-release</name>
<url>http://maven.yourorganization.com:8081/artifactory/libs-release</url>
</repository>
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://maven.yourorganization.com:8081/artifactory/libs-snapshot</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>plugins-release</name>
<url>http://maven.yourorganization.com:8081/artifactory/plugins-release</url>
</pluginRepository>
<pluginRepository>
<snapshots />
<id>snapshots</id>
<name>plugins-snapshot</name>
<url>http://maven.yourorganization.com:8081/artifactory/plugins-snapshot</url>
</pluginRepository>
</pluginRepositories>
<id>artifactory</id>
</profile>
</profiles>
<activeProfiles>
<activeProfile>artifactory</activeProfile>
</activeProfiles>
</settings>
We used this solution because we had problems with internet access in our development machines and some artifacts downloaded corrupted files or didn't download at all. We haven't had problems since.
You have two options for this:
1.) make changes in the settings.xml add this in first tag
<localRepository>C:/Users/admin/.m2/repository</localRepository>
2.) use the -o tag for offline command.
mvn -o clean install -DskipTests=true
mvn -o jetty:run
Maven needs the dependencies in your local repository. The easiest way to get them is with internet access (or harder using other solutions provided here).
So assumed that you can get temporarily internet access you can prepare to go offline using the maven-dependency-plugin with its dependency:go-offline goal. This will download all your project dependencies to your local repository (of course changes in the dependencies / plugins will require new internet / central repository access).
Sadly dependency:go-offline hasn't worked for me as it didn't cached
everything, ie. POMs files and other implicitly mention dependencies.
The workaround has been to specify a local repository location, either within settings.xml file with <localRepository>...</localRepository> or by running mvn with -Dmaven.repo.local=... parameter.
After initial project build, all necessary artifacts should be cached, and then you can reference repository location the same ways, while running Maven build in offline mode (mvn -o ...).
Before going offline you have to make sure that everything is in your local repo, which is required while working offline. Running "mvn dependency:go-offline" for the project(s)/pom(s), you intend to work on, will reduce the efforts to achieve this.
But it´s usually not the whole story, because dependency:go-offline will only download the "bare build" plugins (go-offline / resolve-plugins does not resolve all plugin dependencies). So you have to find a way to download deploy / test / site plugins (and maybe others) and their dependencies into your repo.
Furthermore dependency:go-offline does not download the pom´s artifact itself, so you have to dependency:copy it if required.
Sometimes - as MaDa wrote - you do not know, what you will need, while being offline, which makes it pretty impossible to have a "sufficient" repo.
Anyway having a properly filled repo you only have to add "<offline>true</offline>" to Maven´s settings.xml to go offline.
Do not change the Maven profile (id) you used to fill your repo, while being offline. Maven recognizes the downloaded artifacts in its metadata with an "identity", which is bound to the profile id.
If you're using IntelliJ, you can simply go to Preferences -> Build, Execution, Deployment -> Build Tools -> Maven and check/uncheck Work offline.
Does this work for you?
http://jojovedder.blogspot.com/2009/04/running-maven-offline-using-local.html
Don't forget to add it to your plugin repository and point the url to wherever your repository is.
<repositories>
<repository>
<id>local</id>
<url>file://D:\mavenrepo</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>local</id>
<url>file://D:\mavenrepo</url>
</pluginRepository>
</pluginRepositories>
If not, you may need to run a local server, e.g. apache, on your machines.
(source: jfrog.com)
or
Just use Maven repository servers like Sonatype Nexus http://www.sonatype.org/nexus/ or JFrog Artifactory https://www.jfrog.com/artifactory/.
After one developer builds a project, build by next developers or Jenkins CI will not require Internet access.
Maven repository server also can have proxies configured to access Maven Central (or more needed public repositories), and they can have cynch'ed list of artifacts in remote repositories.
My experience shows that the -o option doesn't work properly and that the go-offline goal is far from sufficient to allow a full offline build:
The solution I could validate includes the use of the --legacy-local-repository maven option rather than the -o (offline) one and
the use of the local repository in place of the distribution repository
In addition, I had to copy every maven-metadata-maven2_central.xml files of the local-repo into the maven-metadata.xml form expected by maven.
See the solution I found here.
A new plugin has appeared to fix shortcomings of mvn dependency:go-offline:
https://github.com/qaware/go-offline-maven-plugin
Add it in your pom, then run mvn -T1C de.qaware.maven:go-offline-maven-plugin:resolve-dependencies. Once you've setup all dynamic dependencies, maven won't try to download anything again (until you update versions).
Answering your question directly: it does not require an internet connection, but access to a repository, on LAN or local disk (use hints from other people who posted here).
If your project is not in a mature phase, that means when POMs are changed quite often, offline mode will be very impractical, as you'll have to update your repository quite often, too. Unless you can get a copy of a repository that has everything you need, but how would you know? Usually you start a repository from scratch and it gets cloned gradually during development (on a computer connected to another repository). A copy of the repo1.maven.org public repository weighs hundreds of gigabytes, so I wouldn't recommend brute force, either.
Here's a clear, straightforward way to cache Maven dependencies for offline development (based on #luka5z and others' comments):
While you have internet access, cache dependencies locally:
mvn -Dmaven.repo.local=dependencies install
Disconnect from the internet, verify that offline mode compilation succeeds:
mvn clean
mvn -o -Dmaven.repo.local=dependencies package
Continue developing offline as long as needed.
In preparation before working offline just run
mvn dependency:go-offline
<offline> false </offline>
<localRepository>${user.home}/.m2/repository</localRepository>
to
<offline> true <offline>
<localRepository>${user.home}/.m2/repository</localRepository>
Change the offline tag from false to true .
will download from repo online