I'am using sonar preview mode in maven project, but when dependencies are downloaded , sonarsource use JFrog Jcenter repository as a mirror of our central repositories, but it doesn't contain all dependencies
logs:
[DEBUG] Using mirror x-maven-central (https://company-url.com/jcenter/) for central (https://company-url.com/x-mvn-delivered).
then I have a warnning:
[WARNING] The POM for com.x.x.http:com.x.as.keycloak.jaxrs.adapter:jar:4.0.6 is missing, no dependency information available
then I got errors for missing dependencies like:
Could not find artifact x.x.x.as.keycloak.jaxrs.adapter:jar:4.0.6 in maven-central (https://company-url.com/jcenter/)
is there a way to disable using this mirror?
Check your maven settings.xml for what mirrors or repos you have.
Normally this file can be found at ~/.m2/settings.xml
or if you download / unzip maven it would be something like:
apache-maven-3.5.0/conf/settings.xml
You can also try to run the dependency resolve on the command line manually:
mvn dependency:resolve
Related
I tried to create maven project using archetype which is absent in Maven central repo, but exists in another remote repository.
In maven-archetype-plugin version 2.4 I could use -DarchetypeRepository param for specify another repo where maven should look for my archetype.
In the new version (3.0) this param doesn't work. (Proof: http://maven.apache.org/archetype/maven-archetype-plugin/generate-mojo.html#archetypeCatalog)
So I needed to use old version of plugin and wrote long command such as
$ mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeGroupId=some.id -DarchetypeArtifactId=some.another.id -DarchetypeVersion=some.version -DarchetypeRepository=repo.url
How can I do the same command using maven-archetype-plugin:3.0?
I tried to use archetypeCatalog=repo.url, but it doesn't work this way, I can only set local or remote repo with it.
Thanks.
Plugin developer's answer:
Allowing to set a URL via commandline is considered to be a security leak, so specifying the repository (id: archetype) in the settings.xml is the right way.
From the Maven Archetype plugin reference:
As of Maven Archetype Plugin 3.0.0 the archetype resolution has changed: it is not possible anymore to specify the repository via the command line (with -DarchetypeRepository=repo.url), but instead the repositories as already defined for Maven are used.
This means that you must add a repository entry to your settings.xml, see the link above.
You can specify your repository in your settings.xml as [archetypeArtifactId]-repo. This is defined as one of the FAQs.
If you do not have authentication, don't specify it in settings.xml.
OR
I just ran the following command,
mvn org.apache.maven.plugins:maven-archetype-plugin:3.0.0:generate
-DarchetypeGroupId=org.grails
-DarchetypeArtifactId=grails-maven-archetype
-DarchetypeVersion=1.0
-DarchetypeCatalog=http://snapshots.repository.codehaus.org
and it gave me following warning,
[WARNING] Archetype not found in any catalog. Falling back to central
repository (http://repo.maven.apache.org/maven2).
[WARNING] Use -DarchetypeRepository= if archetype's repository is elsewhere.
Many of maven's plugins run on the current project's pom.xml file.
Sometimes I need to run a certain plugin on an artifact I downloaded from the repository.
For instance I'm downloading sparkjava using dependency:get like that:
mvn dependency:get -Dartifact com.sparkjava:spark-core:2.5.4
I would like then download all sparkjava's dependencies sources using dependency:sources like that:
mvn dependency:sources -Dartifact com.sparkjava:spark-core:2.5.4
Or even better, run dependency:sources directly on the artifact:
mvn dependency:sources -DinputPom=locationToRepository/com/sparkjava/2.5.4/spark-core-2.5.4.pom
Is it possible to do?
The maven dependency plugin sources goal tells Maven to resolve all dependencies and their source attachments, and displays the version.
You can specifically includes or excludes artifacts by using optional parameters. See the maven dependency plugin documentation.
I am trying to compile a Maven project in the Spring Tools Suite version 3.7 and Maven version 3.3.3.
It fails with
Could not resolve dependencies for project
com.ccs:ccs-nbook-service:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved:
com.ccs:ccs-common-service:jar:R.1.0.BUILD-SNAPSHOT,
com.ccs:ccs-common-ui:jar:R.1.0.BUILD-SNAPSHOT,
com.ccs:ccs-common-core:jar:R.1.0.BUILD-SNAPSHOT: Could not find artifact
com.ccs:ccs-common-service:jar:R.1.0.BUILD-SNAPSHOT in central
I have looked online and cannot locate these maven repositories.
Does anyone know where I can get these repositories or how I can fix this problem please?
I can not find these jar files listed above in the following link
http://mvnrepository.com/
I guess these jars may be developed by someone, but they are not still very stable, so the version name of jar is end up with snapshot
if you could get or find theses jar files, you can install these jars into your local maven repo or upload them to your central repo
The command of installing the jar file to local repo is listed below
mvn install:install-file -Dfile=D:/jar/xxx.jar -DgroupId=xxx.xxx -DartifactId=xxx -Dversion=x.x -Dpackaging=jar
I have several local Maven repositories besides the one located in ~/.m2 directory and I want to simplify the process of installing new artifacts into them from Maven central.
So far I couldn't find a way to tell mvn dependency:get that dependency should be put into a specific local repository.
I did manage to find a way to install a given downloaded artifact using mvn install:install-file -DlocalRepositoryPath=, but I want to be able to get and put dependencies into a specific repository with as few manual steps as possible.
Before you ask why can't I just configure my project to use Maven central directly here is the answer: the project uses Gradle and I do not own its build script (i.e. I can't modify it). The project build script is written to work with several distinct repositories having the same base URI that I fortunately can change using build.properties file. So my idea is to have several local maven repositories in the same root directory and trick the build script to use them.
You can use the maven.repo.local property:
mvn dependency:get -Dmaven.repo.local=/path/to/localrepo
I cloned an open source library project from Github, that I'd like to use for my own Java project. This library depends on some other jars that cannot be found in any public repository. This causes mvn package to fail:
[ERROR] Failed to execute goal on project commons-gdx-core:
Could not resolve dependencies for project
com.gemserk.commons.gdx:commons-gdx-core:jar:0.0.11-SNAPSHOT:
The following artifacts could not be resolved:
com.badlogic.gdx:gdx:jar:0.9.8-SNAPSHOT,
com.gemserk.animation4j:animation4j-core:jar:0.2.2-SNAPSHOT,
com.gemserk.vecmath:vecmath:jar:1.5.3-GEMSERK:
Could not find artifact com.badlogic.gdx:gdx:jar:0.9.8-SNAPSHOT -> [Help 1]
I think I can get these jars from other sources but I don't know how to tell maven where to look for them.
as example, we have Oracle JDBC driver. You must install it into your local maven repository.
Download your lib to local folder (i.e.: Path/to/private/library.jar)
mvn install:install-file -Dfile= -DgroupId=
-DartifactId= -Dversion= -Dpackaging=jar
Or, a more advanced way, if you have a Maven Repository (like Sonatype Nexus), you can deploy it on repository and map it on your project. But, I think that you need the first option.
Use the repositories and repository tags to point to the private repositories in your pom file or update your settings.xml in the same way. Maven will download the artifacts once you tell it where to look.
Answers from apast and Chris are both correct. But if you change your computer or clean up your local repository, you project still can't be compiled. What I suggest is using system dependencies and add the jar under git version control. Here's an example.