i've a maven based project and i'm trying to import it to Spring source tool suite. I am getting the following error.
Description Resource Path Location Type
Could not calculate build plan: Missing:
----------
1) org.apache.maven.plugins:maven-resources-plugin:maven-plugin:2.4.2
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=org.apache.maven.plugins -DartifactId=maven-resources-plugin -Dversion=2.4.2 -Dpackaging=maven-plugin -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=org.apache.maven.plugins -DartifactId=maven-resources-plugin -Dversion=2.4.2 -Dpackaging=maven-plugin -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
----------
1 required artifact is missing.
for artifact:
org.apache.maven.plugins:maven-resources-plugin:maven-plugin:2.4.2
from the specified remote repositories:
central (http://repo1.maven.org/maven2, releases=true, snapshots=false)
Gamex Unknown Maven Problem
It looks like it's asking me to install the maven resourource plugin 2.4.2 but I'm not sure what is the file to download. I tried downloading maven-plugin-plugin-2.4.2-source.jar and feeding it to the command; but it didn't work.
I then went to the maven repository in http://svn.apache.org/viewvc/maven/plugins/tags/maven-resources-plugin-2.4.2/ and downloaded the pof.xml; this also is not working.
If you have seen this problem before pls help me understand what is missing / or what the error message is.
Thanks,
Download the maven resourource plugin 2.4.2[maven-resources-plugin-2.4.2.jar] from http://mirrors.ibiblio.org/pub/mirrors/maven2/org/apache/maven/plugins/maven-resources-plugin/2.4.2/ and do an
mvn install:install-file -DgroupId=org.apache.maven.plugins -DartifactId=maven-resources-plugin -Dversion=2.4.2 -Dpackaging=maven-plugin -Dfile=/path/to/file
followed by clean eclipse :eclipse , clean the project in Eclipse and refresh and try . It should work .
You may be behind firewall. You could try to set an HTTP proxy to bypass the firewall.
In Windows, this file is located at: C:\Documents and Settings\<windows Login>\.m2\settings.xml
You need to provide valid parameters to the <proxy> based on how the network is setup in your organization.
<settings
...
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>put-ur-proxy-servername</host>
<port>80</port>
</proxy>
...
</settings>
Related
I would like to know if it is possible to deploy a custom jar file into an existing maven repository. By custom, I mean, my own existing jar from my local machine.
So, I have a project test-project on gitlab (https://gitlab.com/group/test-project), and it is a java application that I build and deploy using gitlab pipelines. In the build stage, I am doing mvn deploy and the package test-project.jar is pushed to a gitlab maven repository (https://gitlab.com/group/test-project/-/packages).
Now, I have a dependency.jar file which is listed as a dependency in my pom.xml. I would like to push that file into the same maven repository as my test-project.jar. There is nothing about that in the documentation here. https://docs.gitlab.com/ee/user/packages/maven_repository
I tried to push it with maven-deploy-plugin in a way described here http://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html
I am getting an error Failed to deploy artifacts: Could not find artifact... which is strange because I am trying to push new artifact, of course, it does not exist.
I am not sure if this is an issue with GitLab (I doubt that) or I am doing something wrong, or what I want is just not possible.
Edit
I was able to push the package but the thing is I needed to run deploy:deploy-file from the build, not from my local.
This would be the pipeline configuration
stages:
- build
maven-repo-push:
stage: build
image: maven:3.6.2
variables:
GROUP: "com.example"
ARTIFACT: "myproject"
VERSION: "1.1.1"
REPO_PROJECT_ID: "12345678" #gitlab project ID
script:
- mvn deploy:deploy-file
-DgroupId=$GROUP
-DartifactId=$ARTIFACT
-Dversion=$VERSION
-Dpackaging=jar
-Dfile=$ARTIFACT-$VERSION.jar
-DgeneratePom=false
-DpomFile=$ARTIFACT-$VERSION.pom
-Dfiles=$ARTIFACT-$VERSION-tests.zip
-Dtypes=zip
-Dclassifiers=tests
-DrepositoryId=gitlab-maven
-Durl=https://gitlab.com/api/v4/projects/$REPO_PROJECT_ID/packages/maven
-s settings.xml
when: manual
Make sure you have pushed with this configuration the files you want to push in format $ARTIFACT-$VERSION.jar and
The default settings.xml needed for authentication
https://docs.gitlab.com/ee/user/packages/maven_repository/#authenticating-with-a-ci-job-token
Still, my question remains, is it possible to do this from local
You can publish a library/jar from local file system as well, just have a settings.xml something like
<settings>
<servers>
<server>
<id>gitlab-maven</id>
<configuration>
<httpHeaders>
<property>
<name>Private-Token</name>
<value>PUT-YOUR-PRIVATE-TOKEN-HERE</value>
</property>
</httpHeaders>
</configuration>
</server>
</servers>
</settings>
Or if you wan to use a group token or deploy token , make sure you update the property name above , documented here https://docs.gitlab.com/ee/user/packages/maven_repository/#authenticate-with-a-deploy-token-in-maven
And then use this to publish your jar on GitLab's package registry, keep in mind that you can only publish to project api endpoints , but you can use group endpoints to download/install artifacts locally
mvn -s settings.xml deploy:deploy-file \
-Durl=https://gitlab.com/api/v4/projects/<PUT-PROJECT-ID-HERE>/packages/maven \
-DrepositoryId=REPOSITORY-ID # has to match the settings.xml server:id \
-Dfile=your-lib.jar \
-DgroupId=your.group.id \
-DartifactId=artifact-name \
-Dversion=1.0 \
-Dpackaging=jar \
-DgeneratePom=false
I'm using Maven & Nexus repository.
The setup looks good, my project deploy on Nexus properly, but I would like to add my External library loaded by Maven as well on Nexus and I don't find the way to do it.
Do you know how to do it ?
Many thanks,
To deploy an external library you can use the Maven goal deploy:deploy-file.
I took the following example from the Nexus 3 support
On the command line this could look like this:
mvn deploy:deploy-file -DgroupId=com.somecompany -DartifactId=project -Dversion=1.0.0 -DgeneratePom=true -Dpackaging=jar -DrepositoryId=nexus -Durl=http://localhost:8081/repository/maven-releases -Dfile=target/project-1.0.0.jar
The repositoryId is a server defined in your settings.xml.
<servers>
...
<server>
<id>nexus</id>
<username>deployment</username>
<password>deployment123</password>
</server>
</servers>
Hint: As this is a bit cumbersome. Check if your library is available on a public Maven repository. If it is available just add that repository to Nexus as Proxy Maven Repository.
I'm trying to use my own project template, but when I perform the command:
mvn archetype:generate -DarchetypeCatalog=local
I got the following message:
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.
archetypes:maven-archetype-quickstart:1.0)
Choose archetype:
Your filter doesn't match any archetype (hint: enter to return to initial list)
Choose a number or apply filter (format: [groupId:]artifactId, case-sensitive contains): :
I tried many possible solutions that I found here, but I did not succeed ...
My steps: - I created a project in eclipse -Then I went to root directory of this project and performed the following command in prompt:
mvn archetype:create-from-project
and had BUILD SUCCESS.
Then I performed the following command on project's folder
mvn install
and had BUILD SUCCESS
I checked the .m2 folder, and the archetpe-catalog.xml was there:
<?xml version="1.0" encoding="UTF-8"?>
<archetype-catalog xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0 http://maven.apache.org/xsd/archetype-catalog-1.0.0.xsd"
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-catalog/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<archetypes>
<archetype>
<groupId>io.openbdt</groupId>
<artifactId>framework-openbdt</artifactId>
<version>1.0</version>
<description>framework-openbdt</description>
</archetype>
</archetypes>
</archetype-catalog>
In maven's documentation explains that default path of archetypeCatalog=local is path/.m2/archetype-catalog.xml but on debug (mvn archetype:generate -DarchetypeCatalog=local -X), maven search the xml file in path/.m2/repository/archetype-catalog.xml
Note: These steps were typically performed in my notebook, but on my desktop I was unsuccessful. Then I created a new user on the notebook and it also didn't work anymore.
Can anyone help me, please?
Maven 3.5.2 is inconsistent location between read and write.
When set localRepository in settings.xml, mvn archetype:generate -DarchetypeCatalog=local command reads ${localRepository}/archetype-catalog.xml .
When without localRepository setting, that command reads ~/.m2/archetype-catalog.xml .
mvn archetype:update-local-catalog command creates ~/.m2/archetype-catalog.xml with maven-archetype-plugin v2.4.
That command creates ${localRepository}/archetype-catalog.xml with v3.0.1 .
refs:
[ARCHETYPE-529] Maven archetype:generate does not find local archetypes in interactive mode - ASF JIRA
I have the exact same problem and reproduced it with Maven versions 3.3.9 and 3.5.2. Probably something is inconsistent in how mvn install and mvn archetype:generate handle processing archetype-catalog.xml.
Because nothing helped for me as well, I created a soft-link:
ln -s PATH/TO/.m2/archetype-catalog.xml PATH/TO/.m2/repository/archetype-catalog.xml
This made the trick for me. Unfortunately, this works only for unix-like systems.
I'm trying to install ojdbc using maven install:install-file, with the command:
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.3.0 -Dpackaging=jar -Dfile=ojdbc6-11.2.0.3.0.jar -DgeneratePom=true
From a ubuntu ec2-server and a cygwin command prompt, this works great.
From a third ubuntu 14.04 terminal running maven 3.2.5 and java 8, this fails with the error
[ERROR] The goal you specified requires a project to execute, but there is no POM in this directory (/home/user). PLease verify you invoked Maven from the correct directory
Technically, the error message is correct, I'm executing this from the directory containing the jarfile, and there is no pom in there. But install:install-file doesn't require a pom on any of the other servers I've tested the command on.
Is there a way to check that the maven-install-plugin is available? How to correct if it is not?
I'm trying to use Synthetica library with maven but I failed.
There are 2 different jar file I need to import. First one is synthetica.jar and the other one is syntheticablackeye.jar.
I tried mvn install:install-file but it didn't solve the problem.
I can use them with eclipse but currently I do not use any IDE like eclipse also I'm on linux.
Steps I have done:
(This is for synthetica.jar)
mvn install:install-file -Dfile=~/Dropbox/github/ChatAppServer/synthetica.jar -DgroupId=de.javasoft.plaf -DartifactId=synthetica -Dversion=1.0.0 -Dpackaging=jar
(This is for syntheticaBlackEye.jar)
mvn install:install-file -Dfile=~/Dropbox/github/ChatAppServer/syntheticaBlackEye.jar -DgroupId=de.javasoft.plaf -DartifactId=synthetica -Dversion=1.0.0 -Dpackaging=jar
the problem is how should I add dependency when the to jar files file structers are same?
I did these and It worked fine but when I check local mvn repos in my pc(.m2/repo/) there were no jar files. synthetica and syntheticablackeye file structers are same is this a problem? If it is what can I do?
What am I missing?
Edit: When I change artifactId and groupId maven trying to download jar files but they are in local repo?
You have not supplied any details about any errors you are getting or what command you used exactly to install the JARs, so it is hard to know what exactly is not working.
You can install 3rd party JAR files in your local Maven repository with a command like this (see also Maven's Guide to installing 3rd party JARs):
mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id>
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
For example:
mvn install:install-file -Dfile=synthetica.jar -DgroupId=com.synthetica
-DartifactId=synthetica -Dversion=1.0 -Dpackaging=jar
Then you refer to it in the pom.xml of your project with the same Maven coordinates:
<dependency>
<groupId>com.synthetica</groupId>
<artifactId>synthetica</artifactId>
<version>1.0</version>
</dependency>
edit - Do not use the same groupId, artifactId and version for both JAR files, otherwise Maven cannot tell them apart.