This question already has answers here:
Oracle JDBC ojdbc6 Jar as a Maven Dependency
(15 answers)
Closed 6 years ago.
Error: Missing artifact com.oracle:ojdbc6:jar:11.2.0.3
Error shows: Missing artifact com.oracle:ojdbc6:jar:11.2.0.3
all groupId,Version, artifactId is correct
in my project this dependency is not works and i was also try to copy jar on local .m2 oracle maven repo but ,this is not still working. how to resolve this kind of errors?
Copying only the jar to local repo will not help unless you also copy the related pom files. Maven is caching files and if the file was not accessible (e.g. no internet, wrong proxy settings, etc.), maven still remembers it. So remove the cached files (remove whole the particular folder from your .m2 repo) and try to build again. If you have the connection correct and you have also defined the repository where to download the file from, you should be fine.
I'm not sure if this jar file is in maven central, try to add this to your pom.xml or maven settings file.
<repositories>
<repository>
<id>codelds</id>
<url>https://code.lds.org/nexus/content/groups/main-repo</url>
</repository>
</repositories>
add the dependency for it in your pom.xml and when you will do mvn clean install it will do that for you
Use the below maven dependency
<dependency>
<groupId>cn.guoyukun.jdbc</groupId>
<artifactId>oracle-ojdbc6</artifactId>
<version>11.2.0.3.0</version>
Related
This question already has an answer here:
Maven package issue locally?
(1 answer)
Closed 2 years ago.
I run mvn clean package -U
And i get this error message below?
Could not resolve dependencies for project DD2480-Group-15:gs-maven:jar:0.1.0: Could not find artifact com.fasterxml.jackson.core:jackson-databind:jar:3.6 in java.net2 (http://download.java.net/maven/2)
And i have this dependcies in my pom.xml file?
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.11.1</version>
</dependency>
Is jackson deprecreated or?
I have just checked this out.
I removed that dependency from local repo and used maven to refresh the dependencies. It came without any problem. It is not the dependency the problem but the remote repo that you try to get it from.
The repository at http://download.java.net/maven/2 is deprecated, and has been replaced with https://maven.java.net/content/groups/public/
To replace your remote repository
A) If you use your downloaded version of maven then
you must find where your maven folder in your laptop exists. Then under conf/settings.xml you can configure your settings.xml
Then under mirror tag you can configure your remote repository
How to configure mirrors in maven
B) If you use a bundled version of INTELIJ for Maven then check this image of how you can configure your remote repositories
I try to add jnetpcap as a dependency to maven. I found on the internet the following that should be added to the pom file:
<dependency>
<groupId>jnetpcap</groupId>
<artifactId>jnetpcap</artifactId>
<version>1.4.r1425-1g</version>
</dependency>
I tried this with multiple version numbers, but maven can't find the version:
Dependency 'jnetpcap:jnetpcap:1.4.r1425-1g' not found (the version
is colored red).,
Also I tried to add the library via the project structure in IntelliJ. The Maven repository can find the jnetpcap library but when I try to import it i get:
No files were downloaded for jnetpcap:jnetpcap:1.4.r1425-1g.
The library can be manually imported via the jnetpcap.jar file but I need it as a maven dependency in my pom for creating a jar file of my project. Otherwise I get a jar file which can't execute since it is missing the dependency.
Does somebody know how I can include the dependency or otherwise how I can create a jar file of my project without missing this dependency?
The artifact is correct, however you are missing one little detail which is obvious, looking at the info page at mvnrepository.com:
https://mvnrepository.com/artifact/jnetpcap/jnetpcap/1.4.r1425-1g
Especially look at the table line Repositories. There you will see that this artifact is only listed in the "Clojars" repository, a non-standard repository you most likely have not added to your project.
Therefore adding the dependency is not enough, you also have to add the following section:
<repositories>
<repository>
<id>Clojars</id>
<name>Clojars</name>
<url>https://clojars.org/repo/</url>
</repository>
</repositories>
The version of the jar you are requesting is not published to the maven repository.
This would work
<dependency>
<groupId>jnetpcap</groupId>
<artifactId>jnetpcap</artifactId>
<version>1.4.r1425-1g</version>
</dependency>
This question already has answers here:
How to add local jar files to a Maven project?
(35 answers)
Closed 5 years ago.
I feel like I must be lacking some very very basic Maven knowledge here. I have a (couple of) maven project(s) and a shared library. This library should be a separate maven project with its own life cycle. I'm trying to import the library into my project using:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>nl.whatever.com</groupid>
<artifactId>my_shared_library</artifactId>
<version>1.0-SNAPSHOT</groupid>
</dependency>
...
</dependencies>
</dependencyManagement>
But maven keeps looking in my repro instead of trying to find my local build. And worst of all, it keeps looking for a jar. I get:
Could not resolve dependencies for project my.project:ejb:1.0-SNAPSHOT: Could not find artifact nl.whatever.com:my_shared_library:jar:1.0-SNAPSHOT
What's my rookie mistake? Yes, I did do a clean install of my library project.
edit:
My .m2 directory has a settings file redirecting my local repro to
/ws/repro, which contains:
/ws/repro/nl/whatever/com/my_shared_library/1.0-SNAPSHOT/
my_shared_project-1.0-SNAPSHOT.jar.lastUpdate
my_shared_project-1.0-SNAPSHOT.pom
and some property files.
edit2:
I don't think it's a duplicate. I looked at the question linked before posting my question. There is no non-maven project or external jar involved here.
Your local repository is usually in .m2/repository below the user repository. If You do clean install on your library project, it should be installed into this repository (in nl/whatever/com/my_shared_library/...). Then you can use it from all other Maven projects on the same computer.
It is furthermore important that the <packaging> is correct, i.e. the packaging needs to match the artifact you want to build. If the packaging is pom then you only create a pom (like a parent pom or a bom). Leaving out the packaging tag implictely means that you use packaging jar.
You shall try updating your pom.xml with a tag named as repositories.
Maven repositories are the places that hold build artifacts and dependencies of varying types.
A sample maven remote repository tag with its values is:
<repositories>
<repository>
<id>central</id>
<name>Maven Repository</name>
<url>http://repo1.maven.org/maven2</url>
</repository>
</repositories>
To configure multiple repositories you can follow the guide and make use of profile in settings.xml as well.
On a side note, unless following a hierarchy or making use of specific versions of a library. You should use <dependencies> instead of <dependencyManagement>, take a look at the differences between dependencymanagement and dependencies in maven.
I have a project with the following layout:
My goal was to have mvn looking in the project lib dir as an additional location for potential libs that would not be found in maven repository like j-text-utils.jar for example. So I added this in the pom.xml
<repositories>
<repository>
<id>lib</id>
<url>file://${project.basedir}/lib</url>
</repository>
</repositories>
I took the idea from here: http://randomizedsort.blogspot.co.il/2011/10/configuring-maven-to-use-local-library.html
When running mvn compile, it fails to find the relevant libs in the project folder.
Is there anything wrong with the above?
Thx
There is nothing wrong to setup a file based repository. But first and foremost, your directory structure needs to conform to the groupid/artifactid. You should use
set localrepopath=C:\path_to_repo_rootdir
call mvn install:install-file -Dfile=xyz-1.2.jar -DgroupId=com.foo -DartifactId=xyz -Dversion=1.2 -Dpackaging=jar -DlocalRepositoryPath=%localrepopath% -DcreateChecksum=true
It will create directory com\foo\1.2 with all the pom.xml, jar files, checksum files under it.
Then you need to define the dependency for these newly installed artifacts in your own project pom.xml.
If you do not want to setup local repository and only want to add them to the compile classpath, you can consider using "system" scope dependency, but it will make your build not portable and is discouraged in general.
You can do that (just configure the maven-dependency-plugin properly), but I wouldn't suggest that.
There might be a few drawbacks with that direction (e.g., having the Jars there could get into the repository you're using, for many projects it's better to have only one Jar in a dedicated place of your HDD rather than having one of them in each and every project, etc.).
I'm trying to build the project from this site http://www.joptimizer.com/usage.html. I downloaded the sources jar file, unpacked it and ran maven package in the root folder. Maven fails at the last minute saying it couldn't resolve the dependency..
could not find artifact seventytwomiles:architecture-rules:jar:3.0.0-M1 in central repo - repo.maven.apache.org/maven2 ..
I have a feeling I might need to change something in the pom.xml file for this to work, but have no idea what. Googling for this missing dependency lead me no where. In general, how would one know what to do to handle such errors (and also please help with this specific case).
Specifically
According to the Building notes on http://www.joptimizer.com/usage.html:
JOptimizer is build on maven 3.0. Before building it, you must resolve
(in pom.xml) the external dependency on Colt and other dependencies
that aren't in public repositories. Please refer to the "Dependencies"
report for a complete treatment. For ease of use a boundle with
these external libraries is provided (visit "Download"): extract the
boundle in a folder and run the "maven-install.cmd" (translate it in
your own shell language), and you will get the artifacts in your local
repository.
To get the bundle for this, go to http://sourceforge.net/projects/cvxopt/files/, and download the appropriate version of joptimizer-3.X.X-dependencies.zip. Unzip in your own folder, and run mvn install:install-file -DgroupId=seventytwomiles -DartifactId=architecture-rules -Dversion=3.0.0-M1 -Dpackaging=jar -Dfile=architecture-rules-3.0.0-M1.jar -DpomFile=architecture-rules-3.0.0-M1.pom
Generally
Use a tool like http://mavenrepository.com to search for another version of the missing dependency and update your POM with the proper version. If MVNRepository doesn't know about it, you can install the dependency yourself. If you are working with a group of developers, as Eric Jablow mentions, an artifact repository like Nexus or Artifactory is great for sharing non-public dependencies. If it's just you, you can install the artifact in your local repo as described here: How to manually install an artifact in Maven 2?
You should add your own repository manager like Nexus or Artifactory. Then, find out where this dependency is kept; there are repositories other than central. If it's kept on another repository, have your repository mirror that too.
Otherwise, Nexus or Artifactory have commands to enter the dependency manually. Create a local repository called "Third-party" and add it there.
Finally, change your settings.xml file to refer everything to your repository manager.
The most common case for this is when a company refuses to license their products to be held at the central repository. For example, Microsoft won't let its sqljdbc.jar file be distributed through Central. So, you need to add it by hand.
Change the dependency as follows
<dependency>
<groupId>org.architecturerules</groupId>
<artifactId>architecture-rules</artifactId>
<version>3.0.0-rc1</version>
<scope>test</scope>
</dependency>
Add the repository in pom
<repositories>
<repository>
<id>architecturerules.googlecode.com</id>
<url>http://architecturerules.googlecode.com/svn/maven2/</url>
</repository>
</repositories>