I'm writing a maven web application using Netbeans.
I have just started using Maven so I'm not quite sure how it works.
When I try to build the application I get the following error:
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project BioMarkUI: Fatal error compiling: java.lang.RuntimeException: com.sun.tools.javac.code.Symbol$CompletionFailure: class file for uk.ac.ebi.kraken.interfaces.prediction.Label not found -> [Help 1]
In the POM.xml I have added the following:
<dependency>
<groupId>uk.ac.ebi.uniprot.kraken</groupId>
<artifactId>uniprotjapi</artifactId>
<version>1</version>
</dependency>
<repository>
<id>ebi-repo</id>
<name>ebi-repo</name>
<url>http://www.ebi.ac.uk/~maven/m2repo</url>
</repository>
And in the Dependencies folder I have added the uniprotjapi jars.
When I look through the class-files indeed I can not find a class called 'uk.ac.ebi.kraken.interfaces.prediction.Label'. Where is the information that says that it has to contain this class?
Can it cause trouble that I have made up the version id '1'?(It has no version and Netbeans won't allow me to leave it blank)?
The last version is 2014.01, so try this one. You cannot just make up version numbers else Maven won't be able to find it.
And make sure that you have the new repository in the right place in your POM:
<project>
...
<repositories>
<repository>
<id>my-internal-site</id>
<url>http://myserver/repo</url>
</repository>
</repositories>
...
</project>
See also Introduction to repositories
Wrong version, looking in http://www.ebi.ac.uk/~maven/m2repo/uk/ac/ebi/uniprot/kraken/uniprotjapi/2014.01/uniprotjapi-2014.01.pom you can see you should use version 2014.01 instead of 1 (or something else if you do not want the latest).
Related
Note: Before you mark this as duplicate please check all information as after 4 hours of search I couldn't find any close cases. All results were about Android Library or Gradle which is not correct on this case.
Links:
Build Log: https://jitpack.io/xyz/agmdev/AGMCore/3.3.1/build.log
Github Source: https://github.com/Ashenguard/AGMCore
Error:
Exit code: 0
Timed out after 20 min
ERROR: No build artifacts found
Project: Maven - Spigot
Version: 3.3.1
Today after finishing the coding, compiling, testing (All of them were successful on my PC) I decided it's time to upload it on Github and create the 3.3.1 release on jitpack.io so I or any other developer can use it in further projects as dependency.
Everything was ok until I started the new project depending on the new code I just uploaded.
But I faced the dependency not found on my IDE (Intelij) and I thought it is a connection issue or something similar, But after troubleshooting, I got to the Build being failure on jitpack.io.
Before you ask, I did test mvn install and it worked fine without any issue on my PC, but for some reason that I'm not aware of, jitpack fails...
What confused me more only thing that has been changed on pom.xml since the last successful build, is the version number
Possible issues that were not the issue in this case. (I'll update the list)
Packaging not being jar which was, Same as previous versions.
useIncrementalCompilation was not the issue as well.
This error can happen in multiple scenarios.
Scenario 1:
If the build fails
If there are no pom.xml or .pom files in build directory
If artifacts are not copied to $HOME/.m2/...
Scenario 2:
You can fix it by looking at https://github.com/jitpack/maven-modular
Scenario 3:
Try this jitpack example
Note: You can only solve it by yourself making sure you have double check your poms.
--- Updated --
Workaround:
Try to add JitPack repository and dependency in your pom.xml file:
JitPack repository:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
JitPack dependency:
<dependency>
<groupId>com.github.YourProjectName</groupId>
<artifactId>ID</artifactId>
<version>Tag</version>
</dependency>
Maybe it can fix the issue as you said it only occurs on JitPack.
After months of head-scratching, I found out the issue.
The issue was that Jitpack was not able to find one of the plugins I have used in the project, After adding the maven as a plugin repository the issue is gone and Jitpack is doing its job.
<pluginRepositories>
<pluginRepository>
<id>maven-snapshots</id>
<url>https://repository.apache.org/content/repositories/snapshots/</url>
</pluginRepository>
<pluginRepository>
<id>maven-shade-plugin</id>
<url>https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-shade-plugin</url>
</pluginRepository>
</pluginRepositories>
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.
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.
This question already has answers here:
Can I use a GitHub project directly in Maven?
(3 answers)
Closed 2 years ago.
How do I add a Java library from its GitHub repo (the library uses Maven as a build system) as a dependency to my Maven project? Can I do that without downloading and compiling the library?
Now you can import a Java library from a GitHub repo using JitPack.
In your pom.xml:
Add repository:
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
Add dependency
<dependency>
<groupId>com.github.User</groupId>
<artifactId>Repo name</artifactId>
<version>Release tag</version>
</dependency>
It works because JitPack will check out the code and build it. So you'll end up downloading the jar.
If the project doesn't have a GitHub release then its possible to use a commit id as the version.
At the moment there is no way you can do this unless the maintainer of the library provided a way to do this.
So on the title page of the library the should be an instruction containing the repository address like:
<repositories>
<repository>
<id>YOUR-PROJECT-NAME-mvn-repo</id>
<url>https://raw.github.com/YOUR-USERNAME/YOUR-PROJECT-NAME/mvn-repo/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
And a dependency name:
<dependency>
<groupId>...</groupId>
<artifactId>...</artifactId>
<version>...</version>
</dependency>
This means that all artifact of your project including your dependency will be searched in this repo.
You could also have a glance at pom.xml to check if there was an effort made to deploy artifacts to a remote repo. Typically the keywords are oss.sonatype.org or raw.github.com like in this case.
FYI, here is a way to provide a repo for your gihub artifact: Hosting a Maven repository on github.
Github now supports packages https://help.github.com/en/github/managing-packages-with-github-packages/configuring-apache-maven-for-use-with-github-packages
You can follow the steps above to deploy Jar files to github properly.
Another very nice thing about Jitpack is, it has a lookup button on the main page. And if you type the URL of your GitHub repository, it displays different commits of the source code, and you can select which commit/tag you want. The Jitpack creates pom dependencies for you.
It became dead simple.
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.