I'm trying to compile a project in Anypoint studio, and for some reason it's failing on one dependency -
<dependency>
<groupId>com.oracle.jdbc</groupId>
<artifactId>ucp</artifactId>
<version>12.1.0.2</version>
</dependency>
Should say, when I run this on my Windows laptop i have absolutely no issues and the jars download fine. Running it on my macbook, i get the following error -
Archive for required library: '/Users/matt/.m2/repository/com/oracle/jdbc/ucp/12.1.0.2/ucp-12.1.0.2.jar' in project 's-wms-hj-api' cannot be read or is not a valid ZIP file s-wms-hj-api
the message i get when i update project dependencies is -
[WARNING] Invalid POM for com.oracle.jdbc:ucp:jar:12.1.0.2, transitive dependencies (if any) will not be available, enable debug logging for more details
Is it something Mac related?
The dependency is not available in public repositories so the jar has to be installed manually in the local Maven repository. The error was likely because it was incorrectly installed.
The warning is the expected result because that method doesn't provide the pom.
I'm not sure why you don't see the warning in Windows. Perhaps a different Maven version or using a repository manager?
I've always dealt with Oracle the following way (I'm running a mac as well, though it really doesn't matter):
Download the .jar file from the internet somewhere. Install the dependency using Maven using these instructions: https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html
Here's an example of the command, assuming you downloaded the jar for ucp version 12.1.0.2, you are currently in that directory, and the file is called ucp-12.1.0.2.jar:
mvn install:install-file \
-Dfile=ucp-12.1.0.2.jar \
-DgroupId=com.oracle.jdbc \
-DartifactId=ucp \
-Dversion=12.1.0.2 \
-Dpackaging=jar
This should install into your default ~/.m2/repository. If you want you can verify this with:
ls -al ~/.m2/repository/com/oracle/jdbc/ucp/12.1.0.2.jar
You should see a pom file in there.
Maven will now be ready to grab this file when you specify them in your pom. Keep in mind that the groupId, artifactId, and version parameters for the mvn install command relate exactly to what you'd put in the pom for those same fields.
Related
I imported my already working project on another computer and it started to download dependencies.
Apparently my internet connection crashed and now I get the following:
>Build errors for comics; org.apache.maven.lifecycle.LifecycleExecutionException:
Failed to execute goal on project comicsTest: Could not resolve dependencies for project comicsTest:comicsTest:war:0.0.1-SNAPSHOT:
The following artifacts could not be resolved:
org.springframework:spring-context:jar:3.0.5.RELEASE,
org.hibernate:hibernate-entitymanager:jar:3.6.0.Final,
org.hibernate:hibernate-core:jar:3.6.0.Final,
org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final,
org.aspectj:aspectjweaver:jar:1.6.8,
commons-lang:commons-lang:jar:2.5,
>mysql:mysql-connector-java:jar:5.1.13: Failure to transfer org.springframework:spring-context:jar:3.0.5.RELEASE from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced.
>Original error: Could not transfer artifact org.springframework:spring-context:jar:3.0.5.RELEASE from central (http://repo1.maven.org/maven2): No response received after 60000
How do I force maven to update?
mvn clean install -U
-U means force update of snapshot dependencies.
Release dependencies will be updated this way if they have never been previously successfully downloaded. ref: https://stackoverflow.com/a/29020990/32453
If your local repository is somehow mucked up for release jars as opposed to snapshots (-U and --update-snapshots only update snapshots), you can purge the local repo using the following:
mvn dependency:purge-local-repository
You probably then want to clean and install again:
mvn dependency:purge-local-repository clean install
Lots more info available at https://maven.apache.org/plugins/maven-dependency-plugin/examples/purging-local-repository.html
-U seems to force update of all SNAPSHOT dependencies.
If you want to update a single dependency without clean or -U you could just remove it from your local repo and then build.
The example below if for updating slf4j-api 1.7.1-SNAPSHOT:
rm -rf ~/.m2/repository/org/slf4j/slf4j-api/1.7.1-SNAPSHOT
mvn compile
All the answers here didn't work for me. I used the hammer method:
find ~/.m2/ -name "*.lastUpdated" | xargs rm
That fixed the problem :-)
You can do effectively from Eclipse IDE. Of course if you are using it.
Project_Name->Maven->Update Project Configuration->Force Update of Snapshots/Releases
Just in case someone wants only update project's snapshot dependencies and doesn't want to install artifact:
mvn dependency:resolve -U
Don't forget to reimport dependencies in your IDE. In IDEA you need to right click on pom file and choose Maven -> Reimport
If you're unsure what is inside your local repository, I recommend to fire a build with the option:
-Dmaven.repo.local=localrepo
That way you'll ensure to build in a cleanroom environment.
In my case first I did was:
mvn clean install -U
Still it was showing same error then I closed project and again reopened it. Finally worked.
If you are using eclipse IDE then :
Select Project.
Press alt+F5, window for Update Maven Project will pop up.
Check - Force Update of Snapshots/releases and click OK.
If Using Intellij IDE
go to settings/Maven
check Always update snapshots
I used the IntelliJ IDE and I had a similar problem and to solve I clicked in "Generate Sources and Update Folders for All Projects" in Maven tab.
Previous versions of maven did not force the check for missing releases when used -U with mvn clean install, only the snapshots, though newer version supports this.
For someone still struggling with previous version, following can be helpful-
On Windows:
cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i
On Linux:
find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
Whenever maven can't download dependencies for any reason (connectivity/not exists etc), it will add the ".error=Could not transfer artifact" in dependency-name.lastUpdate file in respective folder under $home/.m2 directory. Removing these files will force maven to try fetching the dependencies again.
mvn clean install -e -U -Dmaven.test.skip=true
-e Detailed exception
-U forced update
-DskipTests does not execute test cases, but compiles test case classes to generate corresponding class files under target/test classes.
-Dmaven.test.skip=true, do not execute test cases or compile test case classes.Using maven. test. skip not only skips running unit tests, but also skips compiling test code.
A small suggestion. If you use the IntelliJ Idea compiler, it is recommended to clean the cache
I've got the error in an other context.
So my solution might be useful to others who stumple upon the question:
The problem:
I've copied the local repository to another computer, which has no connection to a special repository.
So maven tried to check the artifacts against the invalid repository.
My solution:
Remove the _maven.repositories files.
You need to check your settings.xml file under <maven_home>/conf directory.
This is one of the most annoying things about Maven. For me the following happens: If I add a dependency requesting more dependencies and more and more but have a slow connection, it seams to stop while downloading and timing out. While timing out all dependencies not yet fetched are marked with place holders in the .m2 cache and Maven will not (never) pick it up unless I remove the place holder entry from the cache (as other stated) by removing it.
So as far as I see it, Maven or more precise the Eclipse Maven plugin has a bug regarding this. Someone should report this.
It's important to add that the main difference of running mvn with -U and without -U is that -U will override your local SNAPSHOT jars with remote SNAPSHOT jars.
Local SNAPSHOT jars created from local mvn install in cases where you have other modules of your proj that generate jars.
For fixing this issue from Eclipse:
1) Add below dependency in Maven pom.xml and save the pom.xml file.
<!-- https://mvnrepository.com/artifact/com.thoughtworks.xstream/xstream -->
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency>
2) Go to project >> Maven >> Update Project
select the project and click OK.
3) Optional step, if it's not resolved till step 2 then do below step after doing step-1
Go to project >> Maven >> Update Project >> check in the checkbox 'Force Update of Snapshots/Releases'
select the project and click OK.
-U is used to force update maven Repo.
Use
mvn -U clean install
I've got the same error with android-maps-utils dependency. Using aar type package in dependency section solve my problem.
By default type is jar so It might be checked what type of dependency in repository is downloaded.
I tried all the answers here but nothing seemed to work. Restarted my computer first then ran mvn clean install -U. That solved my problem.
What maven does is, it downloads all your project's dependencies into your local repo (.m2 folder). Because of the internet causing issues with your local repo, you project is facing problems. I am not sure if this will surely help you or not but you can try deleting all the files within the repository folder inside the .m2 folder. Since there would be nothing in the local repo, maven would be forced to download the dependencies again, thus forcing an update.
Generally, the .m2 folder is located at c:users:[username]:.m2
after using mvn clean install -U run as maven test also and after that update your project using maven-update project
this works in my case
I had this problem for a different reason. I went to the maven repository https://mvnrepository.com looking for the latest version of spring core, which at the time was 5.0.0.M3/ The repository showed me this entry for my pom.xml:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.0.0.M3</version>
</dependency>
Naive fool that I am, I assumed that the comment was telling me that the jar is located in the default repository.
However, after a lot of head-banging, I saw a note just below the xml saying "Note: this artifact it located at Alfresco Public repository (https://artifacts.alfresco.com/nexus/content/repositories/public/)"
So the comment in the XML is completely misleading. The jar is located in another archive, which was why Maven couldn't find it!
We can force to get latest update of release and snapshot repository with below command :
mvn --update-snapshots clean install
I had the same error and running mvn install -U and then running mvn install worked for me.
mvn clean install -U doesn't work. However mvn -U clean followed by mvn clean install does.
I imported my already working project on another computer and it started to download dependencies.
Apparently my internet connection crashed and now I get the following:
>Build errors for comics; org.apache.maven.lifecycle.LifecycleExecutionException:
Failed to execute goal on project comicsTest: Could not resolve dependencies for project comicsTest:comicsTest:war:0.0.1-SNAPSHOT:
The following artifacts could not be resolved:
org.springframework:spring-context:jar:3.0.5.RELEASE,
org.hibernate:hibernate-entitymanager:jar:3.6.0.Final,
org.hibernate:hibernate-core:jar:3.6.0.Final,
org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final,
org.aspectj:aspectjweaver:jar:1.6.8,
commons-lang:commons-lang:jar:2.5,
>mysql:mysql-connector-java:jar:5.1.13: Failure to transfer org.springframework:spring-context:jar:3.0.5.RELEASE from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced.
>Original error: Could not transfer artifact org.springframework:spring-context:jar:3.0.5.RELEASE from central (http://repo1.maven.org/maven2): No response received after 60000
How do I force maven to update?
mvn clean install -U
-U means force update of snapshot dependencies.
Release dependencies will be updated this way if they have never been previously successfully downloaded. ref: https://stackoverflow.com/a/29020990/32453
If your local repository is somehow mucked up for release jars as opposed to snapshots (-U and --update-snapshots only update snapshots), you can purge the local repo using the following:
mvn dependency:purge-local-repository
You probably then want to clean and install again:
mvn dependency:purge-local-repository clean install
Lots more info available at https://maven.apache.org/plugins/maven-dependency-plugin/examples/purging-local-repository.html
-U seems to force update of all SNAPSHOT dependencies.
If you want to update a single dependency without clean or -U you could just remove it from your local repo and then build.
The example below if for updating slf4j-api 1.7.1-SNAPSHOT:
rm -rf ~/.m2/repository/org/slf4j/slf4j-api/1.7.1-SNAPSHOT
mvn compile
All the answers here didn't work for me. I used the hammer method:
find ~/.m2/ -name "*.lastUpdated" | xargs rm
That fixed the problem :-)
You can do effectively from Eclipse IDE. Of course if you are using it.
Project_Name->Maven->Update Project Configuration->Force Update of Snapshots/Releases
Just in case someone wants only update project's snapshot dependencies and doesn't want to install artifact:
mvn dependency:resolve -U
Don't forget to reimport dependencies in your IDE. In IDEA you need to right click on pom file and choose Maven -> Reimport
If you're unsure what is inside your local repository, I recommend to fire a build with the option:
-Dmaven.repo.local=localrepo
That way you'll ensure to build in a cleanroom environment.
In my case first I did was:
mvn clean install -U
Still it was showing same error then I closed project and again reopened it. Finally worked.
If you are using eclipse IDE then :
Select Project.
Press alt+F5, window for Update Maven Project will pop up.
Check - Force Update of Snapshots/releases and click OK.
If Using Intellij IDE
go to settings/Maven
check Always update snapshots
I used the IntelliJ IDE and I had a similar problem and to solve I clicked in "Generate Sources and Update Folders for All Projects" in Maven tab.
Previous versions of maven did not force the check for missing releases when used -U with mvn clean install, only the snapshots, though newer version supports this.
For someone still struggling with previous version, following can be helpful-
On Windows:
cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i
On Linux:
find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
Whenever maven can't download dependencies for any reason (connectivity/not exists etc), it will add the ".error=Could not transfer artifact" in dependency-name.lastUpdate file in respective folder under $home/.m2 directory. Removing these files will force maven to try fetching the dependencies again.
mvn clean install -e -U -Dmaven.test.skip=true
-e Detailed exception
-U forced update
-DskipTests does not execute test cases, but compiles test case classes to generate corresponding class files under target/test classes.
-Dmaven.test.skip=true, do not execute test cases or compile test case classes.Using maven. test. skip not only skips running unit tests, but also skips compiling test code.
A small suggestion. If you use the IntelliJ Idea compiler, it is recommended to clean the cache
I've got the error in an other context.
So my solution might be useful to others who stumple upon the question:
The problem:
I've copied the local repository to another computer, which has no connection to a special repository.
So maven tried to check the artifacts against the invalid repository.
My solution:
Remove the _maven.repositories files.
You need to check your settings.xml file under <maven_home>/conf directory.
This is one of the most annoying things about Maven. For me the following happens: If I add a dependency requesting more dependencies and more and more but have a slow connection, it seams to stop while downloading and timing out. While timing out all dependencies not yet fetched are marked with place holders in the .m2 cache and Maven will not (never) pick it up unless I remove the place holder entry from the cache (as other stated) by removing it.
So as far as I see it, Maven or more precise the Eclipse Maven plugin has a bug regarding this. Someone should report this.
It's important to add that the main difference of running mvn with -U and without -U is that -U will override your local SNAPSHOT jars with remote SNAPSHOT jars.
Local SNAPSHOT jars created from local mvn install in cases where you have other modules of your proj that generate jars.
For fixing this issue from Eclipse:
1) Add below dependency in Maven pom.xml and save the pom.xml file.
<!-- https://mvnrepository.com/artifact/com.thoughtworks.xstream/xstream -->
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency>
2) Go to project >> Maven >> Update Project
select the project and click OK.
3) Optional step, if it's not resolved till step 2 then do below step after doing step-1
Go to project >> Maven >> Update Project >> check in the checkbox 'Force Update of Snapshots/Releases'
select the project and click OK.
-U is used to force update maven Repo.
Use
mvn -U clean install
I've got the same error with android-maps-utils dependency. Using aar type package in dependency section solve my problem.
By default type is jar so It might be checked what type of dependency in repository is downloaded.
I tried all the answers here but nothing seemed to work. Restarted my computer first then ran mvn clean install -U. That solved my problem.
What maven does is, it downloads all your project's dependencies into your local repo (.m2 folder). Because of the internet causing issues with your local repo, you project is facing problems. I am not sure if this will surely help you or not but you can try deleting all the files within the repository folder inside the .m2 folder. Since there would be nothing in the local repo, maven would be forced to download the dependencies again, thus forcing an update.
Generally, the .m2 folder is located at c:users:[username]:.m2
after using mvn clean install -U run as maven test also and after that update your project using maven-update project
this works in my case
I had this problem for a different reason. I went to the maven repository https://mvnrepository.com looking for the latest version of spring core, which at the time was 5.0.0.M3/ The repository showed me this entry for my pom.xml:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.0.0.M3</version>
</dependency>
Naive fool that I am, I assumed that the comment was telling me that the jar is located in the default repository.
However, after a lot of head-banging, I saw a note just below the xml saying "Note: this artifact it located at Alfresco Public repository (https://artifacts.alfresco.com/nexus/content/repositories/public/)"
So the comment in the XML is completely misleading. The jar is located in another archive, which was why Maven couldn't find it!
We can force to get latest update of release and snapshot repository with below command :
mvn --update-snapshots clean install
I had the same error and running mvn install -U and then running mvn install worked for me.
mvn clean install -U doesn't work. However mvn -U clean followed by mvn clean install does.
I'm going to access a database using OJDBC. My project is a Java play project and using SBT. I added,
"com.oracle" % "ojdbc14" % "10.2.0.4.0"
But when I'm compiling the project with this,
It says,
::::::::::::::::::::::::::::::::::::::::::::::
[warn]:: FAILED DOWNLOADS ::
[warn]:: ^ see resolution messages for details ^ ::
[warn]::::::::::::::::::::::::::::::::::::::::::::::
[warn]:: com.oracle#ojdbc14;10.2.0.4.0!ojdbc14.jar
[warn]::::::::::::::::::::::::::::::::::::::::::::::
Also I tried to download the jar manually using this link. Then I got 404.
Is there a way to add the OJDBC14 dependency to a Java play project?
For the maven users (like me) who are trying to download the jars from maven repo: Stop!
The jar's metadata is indexed and pom file is available on maven central but the actual jar is not available. Try clicking on the download link:
http://mvnrepository.com/artifact/com.oracle/classes12/10.2.0.2.0
http://mvnrepository.com/artifact/com.oracle/ojdbc14/10.2.0.4.0
So, you need to get the jar from http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html
And then install to your local repo.
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14 \
-Dversion=10.2.0.4.0 -Dpackaging=jar -Dfile=ojdbc.jar -DgeneratePom=true
In SBT's config add
resolvers += Resolver.mavenLocal to enable local maven repo
P.S.: If you are still reading it: I wish oracle deployed them on maven, (with a note stating if you are using the jar means you are agreeing our terms)!
You can download ojdbc.jar in the following link
http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html
Maven repo does not offer a ojdbc jar link, because oracle Unauthorized
Oracle has a Maven repository now. https://blogs.oracle.com/dev2dev/get-oracle-jdbc-drivers-and-ucp-from-oracle-maven-repository-without-ides
This question already has answers here:
How do I add third-party jars into local Maven repository? [duplicate]
(2 answers)
Closed 7 years ago.
I have a group of aboout 20+ third party jars that I need to add to the RUNTIME of an Eclipse Maven project written in Java. These jars are not available from mvnrepository.com. How can I accomplish this?
I tried Build Path.. Configure Build Path and added the jars manually, but this does not make the jar APIs available in Spring MVC controllers because the jars were added to the Build Path and not to the RUNTIME.
I then tried Project Properties -> Deployment Assembly -> Add -> Archives from file system as per this other posting. This imported the jars into /WEB-INF/lib, but did not make their APIs available.
I then read these instructions for importing 3rd party jars into a maven project, but the instructions say to use this line of code mvn install:install-file -Dfile=<path-to-file>. As you can see, this code only specifies one jar, when I have over 20 third party jars to add. The maven link also does not specify where or when to type the code.
Do I navigate the terminal to the root directory of the Maven repository and then type that line of code with 20 variations, once for each jar?
And do I repeat this every time I do a Maven update from within Eclipse? Clearly there has to be an easier way.
What is the easiest and most effective way to get Eclipse Maven to add all 20+ jars to the runtime of my project, so that my Spring mvc controllers can call the APIs when I try Run As... Run on server, and so that the jars are also bundled up with any war files that get created by Eclipse Maven?**
Edit
#DaveNewton suggested writing a shell script. How would such a script look?
I tried mv /path/to/all/the/jars/* /path/to/workspace/MyApp/src/main/webapp/WEB-INF/lib/ and then typed F5 to make the jars visible in the /WEB-INF/lib folder, but this did not resolve the compilation errors from the code elsewhere in the project that calls the API, even after Project... Clean.
Also, I would like for the Eclipse Maven plugin to be able to manage this as much as possible.
Edit 2
As per #alainlompo's suggestion, I imagine a script that includes the following commands, and then the dependency addition below it. Here is what might be in the script:
mvn install:install-file -Dfile=/thefirst.jar -DgroupId=my.group.id -DartifactId=myartifactid -Dversion={version} -Dpackaging=jar
mvn install:install-file -Dfile=/thesecond.jar -DgroupId=my.group.id -DartifactId=myartifactid -Dversion={version} -Dpackaging=jar
mvn install:install-file -Dfile=/thethird.jar -DgroupId=my.group.id -DartifactId=myartifactid -Dversion={version} -Dpackaging=jar
mvn install:install-file -Dfile=/thefourth.jar -DgroupId=my.group.id -DartifactId=myartifactid -Dversion={version} -Dpackaging=jar
mvn install:install-file -Dfile=/thefifth.jar -DgroupId=my.group.id -DartifactId=myartifactid -Dversion={version} -Dpackaging=jar
mvn install:install-file -Dfile=/thesixth.jar -DgroupId=my.group.id -DartifactId=myartifactid -Dversion={version} -Dpackaging=jar
mvn install:install-file -Dfile=/theseventh.jar -DgroupId=my.group.id -DartifactId=myartifactid -Dversion={version} -Dpackaging=jar
And so on for all 20+ jars.
Here is what the dependency tag in the pom.xml might be:
<dependency>
<groupId>my.group.id</groupId>
<artifactId>myartifactid</artifactId>
<version>what goes here?</version>
</dependency>
I would guess I would add some symbols to the groupid to make sure that Maven cannot find anything with the same name at mvnrepository.com. This way the Eclipse Maven update could be used. But what do I use for the version number? Many of the jars have different version numbers.
Also note I am using linux. What would the actual shell script and dependency tag look like?
I think the simplest way to solve this issue is to add your jars to your maven local repository. There is answer for this on SO here and also here. The jars will then be available in Eclipse but also outside eclipse for any of your project that is using maven as a build tool and where the jar is correctly referenced (with the groupId, artifactId and version dependency informations properly provided) as in the following example:
<dependencies>
....
<dependency>
<groupId>org.matlabcontrol</groupId>
<artifactId>matlabcontrol</artifactId>
<version>4.1.0</version>
</dependency>
</dependencies>
And then you may easily write a .bat or a .sh (depending on the OS) that will do this operation once and for all.
[EDIT]
#CodeMed regarding the jars that are behind the link that you've shared in your comments, some of them are related to each others and therefore will share the same version as the same groupId and most certainly different artifactIds
Example:
org.eclipse.emf.common_2.5.0.v200906151043.jar
org.eclipse.emf.ecore.xmi_2.5.0.v200906151043.jar
Obviously the suffixed 4 parts number is the version number of the jar. So You already have the version number and since it is common to many jar it is to your advantage to define a variable for it in your .bat file and a property for it in your pom.xml file.
Also the groupId will generaly be the same for all related jars. Therefore you could suspect that the groupId would be org.eclipse.emf, and if you google this: maven dependency for org.eclipse.emf + 2.5.0.v200906151043you would find among other links a link to a pom.xml file on a related github project with the following depency informations
I would now be logical to suspect that the artifactId is what's left from the name of the jar commonin one case and ecore.xmiin the other case. This will be checked against a little googling or on Mvnrepository (for example here where we see that this artifact id is also prefixed by the group id)
Therefore we would write the following kind of instructions in a .bat file to install these jars in our local repository
First define a variable to hold the version number
set eclipseEmfVersion=2.5.0.v200906151043
call mvn install:install-file -Dfile=org.eclipse.emf.ecore.xmi_2.5.0.v200906151043.jar -DgroupId=org.eclipse.emf -DartifactId=org.eclipse.emf.ecore.xmi -Dversion=%eclipseEmfVersion% -Dpackaging=jar
call mvn install:install-file -Dfile=org.eclipse.emf.common_2.5.0.v200906151043.jar -DgroupId=org.eclipse.emf -DartifactId=common -Dversion=%eclipseEmfVersion% -Dpackaging=jar
In the case of the second jar however I find on MvnRepository that the artifactId does not set the groupId as its prefix (see here)
Note also that in a .bat file you need to use call mvn (instead of simply mvn as you would do had you only one instruction to run) to be able to execute many maven instruction sequentially.
On the same pattern you can distinguish another group of related jars with the groupId: org.openhealthtools.mdht.uml.cdaand version number 1.2.0.201405161834. You can apply the same approach to install them in your local repository
Here is the successfull test I run (from a bat file that I created in the same directory where I unzip your file) using the first four jars in your list of jars
call mvn install:install-file -Dfile=net.sourceforge.lpg.lpgjavaruntime_1.1.0.v200803061910.jar -DgroupId=net.sourceforge.lpg -DartifactId=net.sourceforge.lpg.lpgjavaruntime -Dversion=1.1.0.v200803061910 -Dpackaging=jar
call mvn install:install-file - Dfile=org.apache.commons.lang_2.3.0.v201005080501.jar - DgroupId=org.apache.commons -DartifactId=lang -Dversion=2.3.0.v201005080501 - Dpackaging=jar
call mvn install:install-file - Dfile=org.eclipse.core.runtime_3.8.0.v20120521-2346.jar - DgroupId=org.eclipse.birt.runtime -DartifactId=org.eclipse.core.runtime - Dversion=3.8.0.v20120521-2346 -Dpackaging=jar
set cdaversion=1.2.0.201405161834
call mvn install:install-file - Dfile=org.openhealthtools.mdht.uml.cda.ihe_1.2.0.201405161834.jar - DgroupId=org.openhealthtools.mdht.uml.cda -DartifactId=ihe - Dversion=%cdaversion% -Dpackaging=jar
You can easily complete the .bat and after running you may manually check the successfull installation of all the jars in your maven local repository.
I have some local jar files from a non-maven project which I wish to include in my maven-based eclipse project.
These jar files are undergoing a lot of change as me and my project buddy attempt to 'fix' them, so I'd prefer not to upload them to a repository to avoid making a maven version of this non-maven project if this is possible.
Of course, the jar files need to be embedded in the resulting deployment jar. We did this before using Ant which let us specify that those jar files should be included.
How do you do the same thing in maven? Take into consideration that we do have maven dependencies too which all work fine and aren't required in the deployment. Some answers I've seen don't allow for this requirement.
Here's one of my attempts - the problem is that the jar does not get embedded:
<dependency>
<groupId>se.krka.kahlua</groupId>
<artifactId>kahlua-core</artifactId>
<version>5.1_2.1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/kahlua-5.1_2.1.0-core.jar</systemPath>
</dependency>
System paths are a very bad idea. When anybody else checks out your projects, he cannot build it anymore. (I always see such crap in many companies). The right solution would be to install the jar into the local repository:
$ mvn install:install-file -Dfile=[JAR NAME] -DgroupId=[GROUPID OF
JAR] -DartifactId=[ARTIFACT OF JAR] -Dversion=[VERSION OF JAR]
-Dpackaging=jar
In your project, you just add the dependency as usual after you installed the jar into the local repository.
<dependency>
<groupId>[GROUPID OF JAR]</groupId>
<artifactId>[ARTIFACT OF JAR]</artifactId>
<version>[VERSION OF JAR]</version>
</dependency>
You can use maven-install-plugin to install kahlua-5.1_2.1.0-core.jar into the local repository then this dependency will behave as any other, see http://maven.apache.org/plugins/maven-install-plugin/usage.html. Or make a remote repository in a location shared with your buddy and let him upload his jar there with maven-deploy-plugin:deploy-file (http://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html) each time he changes it and add this repository to your pom. You can use SNAPSHOT version if this jar changes often