I'm trying to build a project in Eclipse with Maven. However I get the error
Missing artifact net.sf.doodleproject:numerics4j:jar:1.3
Running
mvn install
I got
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - tahrirproject:tahrir:jar:0.0.1-SNAPSHOT
[INFO] task-segment: [install]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2 resources
Downloading: http://repo2.maven.org/maven2/net/sf/doodleproject/numerics4j/1.3/numerics4j-1.3.pom
[INFO] Unable to find resource 'net.sf.doodleproject:numerics4j:pom:1.3' in repository repo2_maven_org (http://repo2.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/net/sf/doodleproject/numerics4j/1.3/numerics4j-1.3.pom
[INFO] Unable to find resource 'net.sf.doodleproject:numerics4j:pom:1.3' in repository central (http://repo1.maven.org/maven2)
[WARNING] Overriding profile: 'null' (source: pom) with new instance from source: pom
[WARNING] Overriding profile: 'null' (source: pom) with new instance from source: pom
[WARNING] Overriding profile: 'null' (source: pom) with new instance from source: pom
Downloading: http://repo2.maven.org/maven2/net/sf/doodleproject/numerics4j/1.3/numerics4j-1.3.jar
[INFO] Unable to find resource 'net.sf.doodleproject:numerics4j:jar:1.3' in repository repo2_maven_org (http://repo2.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/net/sf/doodleproject/numerics4j/1.3/numerics4j-1.3.jar
[INFO] Unable to find resource 'net.sf.doodleproject:numerics4j:jar:1.3' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Missing:
----------
1) net.sf.doodleproject:numerics4j:jar:1.3
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=net.sf.doodleproject -DartifactId=numerics4j -Dversion=1.3 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=net.sf.doodleproject -DartifactId=numerics4j -Dversion=1.3 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) tahrirproject:tahrir:jar:0.0.1-SNAPSHOT
2) net.sf.doodleproject:numerics4j:jar:1.3
----------
1 required artifact is missing.
for artifact:
tahrirproject:tahrir:jar:0.0.1-SNAPSHOT
from the specified remote repositories:
repo2_maven_org (http://repo2.maven.org/maven2),
central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Mon Mar 26 21:17:33 IST 2012
[INFO] Final Memory: 12M/105M
[INFO] ------------------------------------------------------------------------
So it seems like it's trying to download from a central repository even though it's specified in the pom.xml file.
pom.xml is here
Change pom section to:
<repositories>
<repository>
<id>doodleproject-repo</id>
<name>DoodleProject Maven 2 Repository</name>
<url>http://doodleproject.sourceforge.net/maven2/release</url>
</repository>
<repository>
<id>repo2_maven_org</id>
<url>http://repo2.maven.org/maven2</url>
</repository>
</repositories>
Related
TL;DR
Maven does not find <importedGroupid>:<importedArtifactid>:jar:1.0 in repository file://<homeDirectory>/.m2/repository/. The package actually is in <homeDirectory>/.m2/repository/<importedGroupid>/<importedArtifactid>/1.0/
I do not presume to understand Maven, but the two potential reasons I could imagine are:
it gets confused with : and / (i.e. UNIX style path seperator vs. whatever : means in Maven), or
if : and / are actually interpreted as the same, the path it searches for includes another subdirectory level jar that is not present in the real directory structure.
Detailed Explanation
I was trying to import a package locally in Maven (as the package is not deployed online). Various answers (e.g., this, and this) on stackoverflow recommend running mvn install on the jar containing the package like so (assuming the jar is in /usr/share/java, is version 1.0, etc. etc.):
mvn install:install-file -Dfile=/usr/share/java/<importedArtifactid>-1.0-SNAPSHOT.jar -DgroupId=<importedGroupid> -DartifactId=<importedArtifactid> -Dversion=1.0 -Dpackaging=JAR -DgeneratePom=true
and defining this in the current package's pom.xml by adding:
<repository>
<id>repository</id>
<url>file://${user.home}/.m2/repository/</url>
</repository>
The mvn install command deploys the package into <homeDirectory>/.m2/repository/. So far, this works fine:
<prompt> $ mvn install:install-file -Dfile=/usr/share/java/<importedArtifactid>-1.0-SNAPSHOT.jar -DgroupId=<importedGroupid> -DartifactId=<importedArtifactid> -Dversion=1.0 -Dpackaging=JAR -DgeneratePom=true
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building <currentDirectoryProject> 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) # <currentDirectoryProjectArtifactid> ---
[INFO] Installing /usr/share/java/economicsl-1.0-SNAPSHOT.jar to <homeDirectory>/.m2/repository/<importedGroupid>/<importedArtifactid>/1.0/<importedArtifactid>-1.0.JAR
[INFO] Installing /tmp/mvninstall256012398997457078.pom to <homeDirectory>/.m2/repository/<importedGroupid>/<importedArtifactid>/1.0/<importedArtifactid>-1.0.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.489 s
[INFO] Finished at: 2017-05-11T19:11:12+01:00
[INFO] Final Memory: 9M/292M
[INFO] ------------------------------------------------------------------------
<prompt> $
The package also appears in <homeDirectory>/.m2/repository/
<prompt> $ ls `<homeDirectory>/.m2/repository/<importedGroupid>/<importedArtifactid>/1.0/`
<importedArtifactid>-1.0.JAR <importedArtifactid>-1.0.jar.lastUpdated <importedArtifactid>-1.0.pom _remote.repositories
<prompt> $
However, building the project that attempts to import the package fails:
<prompt> $ mvn package -U
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building <currentDirectoryProject> 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: file://<homeDirectory>/.m2/repository/<importedGroupid>/<importedArtifactid>/1.0/<importedArtifactid>-1.0.jar
Downloading: https://repo.maven.apache.org/maven2/<importedGroupid>/<importedArtifactid>/1.0/<importedArtifactid>-1.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.730 s
[INFO] Finished at: 2017-05-12T17:59:43+01:00
[INFO] Final Memory: 13M/292M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project <currentDirectoryProjectArtifactid>: Could not resolve dependencies for project <currentDirectoryProjectGroupid>:<currentDirectoryProjectArtifactid>:jar:1.0-SNAPSHOT: Could not find artifact <importedGroupid>:<importedArtifactid>:jar:1.0 in repository (file://<homeDirectory>/.m2/repository/) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
<prompt> $
If an absolute path to the jar in /usr/share/java is defined in the pom.xml, the project builds successfully with a warning about not using absolute paths, but execution fails as it does not find the package again this time.
Maven version is Apache Maven 3.3.9.
Placeholders
<currentDirectoryProject> The project that is supposed to import the other package. All terminal commands are executed from the root directory of this project (this is where its pom.xml resides).
<currentDirectoryProjectArtifactid> ArtifactID of the project that is supposed to import the other package.
<currentDirectoryProjectGroupid> GroupID of the project that is supposed to import the other package.
<importedArtifactid> ArtifactID of the project that is to be imported
<importedGroupid> GroupID of the project that is to be imported
<homeDirectory> the user's home directory, i.e. /home/<userName>
<prompt> terminal prompt
You have a file extension "JAR" in upper case and maven is looking "jar" in lower case. If your file system is case sensitive, then that's important.
I am trying download a jersey-quickstart-webapp using maven. I am unable to figure out what is wrong with my command below.
mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archetypes -DarchetypeArtifactId=jersey-quickstart-webapp -DarchetypeVersion=2.2
The errors I get are below: what am I doing wrong here?
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] >>> maven-archetype-plugin:3.0.0:generate (default-cli) > generate-sources # standalone-pom
[INFO] Generating project in Interactive mode
[WARNING] No archetype found in remote catalog. Defaulting to internal catalog
[WARNING] Archetype not found in any catalog. Falling back to central repository
(http://repo.maven.apache.org/maven2).
[WARNING] Use -DarchetypeRepository=<your repository> if archetype's repository is elsewhere.
Downloading: http://repo.maven.apache.org/maven2/org/glassfish/jersey/archetypes/jersey-quickstart-webapp/2.2/jersey-quickstart-webapp-2.2.pom
Downloading: https://repo.maven.apache.org/maven2/org/glassfish/jersey/archetypes/jersey-quickstart-webapp/2.2/jersey-quickstart-webapp-2.2.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.330 s
[INFO] Finished at: 2017-03-29T20:46:00+05:30
[INFO] Final Memory: 14M/139M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.0:generate (default-cli) on project standalone-pom: The desired archetype does not exist (org.glassfish.jersey.archetypes:jersey-quickstart-webapp:2.2) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
The version you have specified is wrong(NOT 2.2 its 2.25.1). Try to run this:
mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archetypes -DarchetypeArtifactId=jersey-quickstart-webapp -DarchetypeVersion=2.25.1
The issue was not with the command but the settings.xml.
I had to add my local artifactory setton
Install manually jar file into repository.
I want to install this SDK as maven dependency.
https://developer.intuit.com/docs/0100_quickbooks_online/0400_tools/0005_accounting/0200_java/0002_installing_the_java_sdk_for_quickbooks
I tried this:
mvn install:install-file -DgroupId=com.intuit.code.devkit.v3 -DartifactId=ipp-v3-java-devkit -Dversion=2.5.0 -Dpackaging=jar -Dfile=c:\lib\ipp-java-qbapihelper-1.2.1-jar-with-dependencies.jar
But I get
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) # standalone-pom ---
[INFO] Installing c:\lib\ipp-java-qbapihelper-1.2.1-jar-with-dependencies.jar to C:\Users\plamen\.m2\repository\com\intuit\code\devkit\v3\ipp-v3-java-devkit\2.5.0\ipp-v3-java-devkit-2.5.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.631 s
[INFO] Finished at: 2016-09-02T17:04:51+03:00
[INFO] Final Memory: 7M/123M
[INFO] ------------------------------------------------------------------------
When I browse my local repository I can't find any jar file into the directory. Can somebody give some advice how I can fix this?
What I've done in the past to make this work is:
Copy the jar file(s) of interest to a temp folder i.e. project root/tmp
Run the following command (adjusting the parameters accordingly) in the command line from the the project root directory:
mvn install:install-file -Dfile=tmp/<filename>.jar -DgroupId=intuit.code.devkit.v3 -DartifactId=ipp-v3-java-devkit -Dversion=2.5.0 -Dpackaging=jar -DlocalRepositoryPath=<repo path> (i.e. src/dependencies/jars)
After that command you should see a src/dependencies/jars/com/... directory with maven artifacts under it
Add dependency to your pom.xml
<!— <project> is the parent element —>
<repositories>
<repository>
<id>system-jars</id>
<url>file://${basedir}/src/dependencies/jars</url>
</repository>
</repositories>
<!— Add the dependency —>
<dependency>
<groupId>com.intuit.code.devkit.v3</groupId>
<artifactId>ipp-v3-java-devkit</artifactId>
<version>2.5.0</version>
</dependency>
Perform a maven clean and package. Verify the classes are included in the end artifact and then delete the tmp directory once everything is correct.
I have created my own jar file and I included it into my project by running:
mvn install:install-file -Dfile=/Users/vladioffe/git/evappcom/evappcom/evapcom-1.0.jar -DgroupId=com.evapp.code -DartifactId=evappcom -Dversion={1.0} -Dpackaging=jar
The build succeeded - here is the output:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building EvApp_Server 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install-file (default-cli) # EvApp_Server ---
[INFO] Installing /Users/vladioffe/git/evappcom/evappcom/evappcom-1.0.jar to /Users/vladioffe/.m2/repository/com/evapp/code/evappcom/{1.0}/evappcom-{1.0}.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.557s
[INFO] Finished at: Tue Jan 21 14:46:32 IST 2014
[INFO] Final Memory: 3M/81M
[INFO] ------------------------------------------------------------------------
When I have added the dependency to the pom file I encountered an error, here is the dependency:
<dependency>
<groupId>com.evapp.code</groupId>
<artifactId>evappcom</artifactId>
<version>1.0</version>
</dependency>
And the error I see near the <dependency> tag is:
Missing artifact com.evapp.code:evappcom:jar:
1.0
I tried to:
Restart eclipse
Clean project
re-install jar
disable and enable Maven
Update Project
Thanks!
Version is not supposed to be in brackets:
-Dversion={1.0} // it must be -Dversion=1.0
I'm trying to create a Magnolia project archetype:
I'm running
mvn archetype:generate -DarchetypeCatalog=http://nexus.magnolia-cms.com/content/groups/public/
I choose
5: http://nexus.magnolia-cms.com/content/groups/public/ -> info.magnolia.maven.archetypes:magnolia-project-archetype (An archetype to create a Magnolia project (a parent pom and a webapp))
archetype version I choose 1.1.0
Define value for property 'magnolia-version': 5.0.4
When I run the maven build, the webapp build fails because it cant find some vaadin libraries
[WARNING] The POM for org.vaadin.addons:icepush:jar:0.5.3 is missing, no dependency information available
[WARNING] The POM for org.vaadin.addons:cssinject:jar:2.0.3 is missing, no dependency information available
[WARNING] The POM for org.vaadin.addons:gwt-graphics:jar:1.0.0 is missing, no dependency information available
[WARNING] The POM for org.vaadin.addons:ckeditor-wrapper-for-vaadin:jar:7.8.3 is missing, no dependency information available
[WARNING] The POM for org.vaadin.addon:easyuploads:jar:7.0.0 is missing, no dependency information available
[WARNING] The POM for org.vaadin.addons:refresher:jar:1.2.1.7 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] myapp (parent pom) ............................. SUCCESS [0.394s]
[INFO] myapp: webapp .................................. FAILURE [1.305s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.962s
[INFO] Finished at: Wed Sep 18 13:53:45 CEST 2013
[INFO] Final Memory: 7M/121M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project myapp-webapp: Could not resolve dependencies for project myapp-webapp:war:1.0-SNAPSHOT: The following artifacts could not be resolved: org.vaadin.addon:easyuploads:jar:7.0.0, org.vaadin.addons:refresher:jar:1.2.1.7, org.vaadin.addons:cssinject:jar:2.0.3, org.vaadin.addons:icepush:jar:0.5.3, org.vaadin.addons:gwt-graphics:jar:1.0.0, org.vaadin.addons:ckeditor-wrapper-for-vaadin:jar:7.8.3: Failure to find org.vaadin.addon:easyuploads:jar:7.0.0 in http://nexus.magnolia-cms.com/content/groups/public was cached in the local repository, resolution will not be reattempted until the update interval of magnolia.public has elapsed or updates are forced -> [Help 1]
[ERROR]
Do I need to add some maven repository ?
Solved it by adding following repository in my pom.xml
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>