I've set up a GitLab project that uses Oracle JDBC. The Oracle driver is not in Maven Central Repository, so I've added it on my project manually. That means that, locally, my builds run just fine.
The catch: I want to use GitLab's devops feature. However, my project won't build on GitLab because of this dependency issue, giving me the following error on maven build:
Could not find artifact com.oracle:ojdbc7:jar:12.1.0.2 in central
(https://repo.maven.apache.org/maven2) -> [Help 1]
I want to know how can I supply this dependency so that my project can be built successfully.
Has anyone experienced a similar issue?
POM.xml contains:
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
If your pom.xml contains a dependency - then you should provide it or delete it.
If you're not trying to understand "maven" way of doing things and just want to make it work - try this "lazy" solution:
<repository>
<id>code-lds</id>
<url>https://code.lds.org/nexus/content/groups/main-repo</url>
</repository>
Add this repository to your section. It's a widely-used third-party repository that contains several common artifacts like Oracle drivers and etc.
Related
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>
I want to install pig-maven, I download it and run mvn install command, then it tell me an error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-remote-resources-plugin:1.5:process (default) on project pig-main: Failed to resolve dependencies for one or more projects in the reactor. Reason: Missing:
[ERROR] ----------
[ERROR] 1) org.apache.hive:hive-exec:jar:core:0.14.0-SNAPSHOT`
here is some relevant information in pom.xml:
<repositories>
<repository>
<id>repo.apache.snapshots</id>
<url>http://repository.apache.org/content/groups/snapshots-group/</url>
</repository>
<repository>
<id>repo.jboss.org</id>
<url>http://repository.jboss.com/nexus/content/groups/public/</url>
</repository>
</repositories>
...
<hive.version>0.14.0-SNAPSHOT</hive.version>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-exec</artifactId>
<version>${hive.version}</version>
<scope>compile</scope>
<classifier>core</classifier>
</dependency>
in specified snapshot repository I find it has some information of target jar but havent jar and pom. So then what should I do to install pig. The relate data as below:
What you are trying to install is the last version on github, it's a snapshot version and uses snapshots dependencies. You may try follow the tutorial of PIG and install a stable version.
It seems you are trying to install the development version of the project, however it depends on SNAPSHOT dependencies which are not available on your configured repositories.
Depending on what you really want you can:
As #grape_mao suggested, install a stable version using the proper guide (on the Github project go to releases and use the one you want)
If you really want to use this development version:
Find and configure a repository containing hive-exec-0.14.0-SNAPSHOT, the one your are showing does not contain the dependency or
Download and install yourself hive-exec-0.14.0-SNAPSHOT.jar from either a commit from the source code or a .jar file.
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>
I'm intrigued to test new frameworks in the Java world, and decided to create a new project that takes advantage of Maven and db4o. I'm starting to get a hang of Maven, but I have a hard time adding db4o as a dependency to the project. First problem is that db4o doesn't exist in the official Maven repositories. Next up comes the problem that db4o seem to have recently restructured their whole site's URI:s, so I'm getting 'site not found' messages all the time when I try to navigate their site.
I found somewhere a potential Maven repository that should be at https://source.db4o.com/maven but I get all the time "Error reading archetype catalog https://source.db4o.com/maven Unable to locate resource in repository" when I try to access it.
So, any suggestions on how I'll get db4o up through Maven? I've managing Maven through Eclipse with the M2Eclipse plugin.
Works for me with the following snippet:
<project>
<repositories>
<repository>
<id>source.db4o</id>
<url>http://source.db4o.com/maven</url>
</repository>
</repositories>
...
<dependencies>
<dependency>
<groupId>com.db4o</groupId>
<artifactId>db4o-full-java5</artifactId>
<version>8.1-SNAPSHOT</version> <!-- latest version -->
</dependency>
...
</dependencies>
</project>
You won't see a dependency in m2eclipse unless the Maven repository has been indexed with the Nexus indexer...very few 3rd party repositories are.
I'm using Netbeans and I want to grab the latest hibernate artifact from the jboss maven repository.
I have added the repository in netbeans, and I can navigate to it within the repository browser.
After I add this dependency to my pom.xml file and attempt to build my project, I get an error saying that the artifact could not be downloaded and i should attempt to do so manually.
From the output, it appears that it is only trying to download from the default central repository, and not the new repository i have added.
How I make it so that netbeans downloads the artifact I need from the jboss repository?
==== maven output ====
Downloading: http://repo1.maven.org/maven2/org/hibernate/hibernate/3.5.0.Beta-1/hibernate-3.5.0.Beta-1.pom
Unable to find resource 'org.hibernate:hibernate:pom:3.5.0.Beta-1' in repository central (http://repo1.maven.org/maven2)
Downloading: http://repo1.maven.org/maven2/org/hibernate/hibernate/3.5.0.Beta-1/hibernate-3.5.0.Beta-1.pom
Unable to find resource 'org.hibernate:hibernate:pom:3.5.0.Beta-1' in repository central (http://repo1.maven.org/maven2)
[ERROR]BUILD ERROR
Failed to resolve artifact.
Missing:
1) org.hibernate:hibernate:pom:3.5.0.Beta-1
Path to dependency:
1) com.noisyair:wisi:war:0.0.1-SNAPSHOT
2) org.hibernate:hibernate:pom:3.5.0.Beta-1
1 required artifact is missing.
for artifact:
com.noisyair:wisi:war:0.0.1-SNAPSHOT
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
Adding the JBoss repository in NetBeans is one thing but this won't make the content of this repository available to Maven projects. To do so, you need to add the JBoss Maven repository to the pom.xml of your project. Actually, the error you get has nothing to do with NetBeans, it is a pure Maven "issue".
To fix it, provide the following configuration:
<project>
...
<repositories>
<repository>
<id>repository.jboss.org</id>
<url>http://repository.jboss.org/maven2</url>
</repository>
...
</repositories>
<dependencies>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.5.0-Beta-2</version>
</dependency>
...
</dependencies>
...
</project>
And Hibernate's jar will get downloaded successfully from the JBoss repository.
By "added the respoitory in netbeans" you mean that you added the repository for the repository browser? Then check that that repository is also declared in your pom file.
Netbeans 6.8 has really great maven support , for maven best practices see
MavenBestPractices ,There is a section called Utilizing and managing Maven repositories that show you how to add repositories to Netbeans , but as previously said you need to add repository to POM that has your artifacts.