I am trying to implement hoptoad in my existing maven project. I ve given the following lines in pom.xml as suggested in http://code.google.com/p/hoptoad/
<project>
<repositories>
<repository>
<id>hoptoad-repository</id>
<name>Hoptoad Repository</name>
<url>http://hoptoad.googlecode.com/svn/maven2</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>code.lucamarrocco</groupId>
<artifactId>hoptoad-notifier</artifactId>
<version>1.8</version>
</dependency>
</dependencies>
</project>
When i try to use the HoptoadNotice in my catch block, i m getting ClassNotFoundException. I am using Eclipse IDE. I am not able to figure out, that the problem is because of inclusion of this code(in pom) or in the IDE. I can understand that the inclusion of these lines alone do not help the code to recognize the jar. So, i tried installing the jar in maven repository. But still it did not help.
Note:- I have not just blindly copied as shown above, directly into the pom.xml. I have included the lines of code wrt <dependencies> and <repositories> blocks.
The maven configuration looks correct.
Make sure that the hoptoad-notifier-1.8.jar is correct deployed.
For an standalone app, this means for example specified in the argument list or the manifiest.
For an web app, it means the jar is copied (by maven, not by you) in the libs folder.
Related
I'm following the "R for Data Science" tutorial for using the tidyverse. Because I'm eventually going to create a data analysis program in Java using Renjin, I need to be able to use the tidyverse's packages in my Maven project in Eclipse.
I've added the following dependencies in pom.xml:
<dependencies>
<dependency>
<groupId>org.renjin</groupId>
<artifactId>renjin-script-engine</artifactId>
<version>3.5-beta76</version>
</dependency>
<dependency>
<groupId>org.renjin.cran</groupId>
<artifactId>tidyverse</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
I'm positive that the first dependency (renjin-script-engine) works. And I'm pretty sure the second dependency works as well. But whenever I run pom.xml and use the Maven test feature, it gives me the following error (I shortened it to just the important part):
[ERROR] Failed to execute goal on project Test1: Could not resolve dependencies for project Tests:Test1:jar:0.0.1-SNAPSHOT: org.renjin.cran:tidyverse:jar:1.3.2 was not found in https://nexus.bedatadriven.com/content/groups/public/ during a previous attempt.
I'm assuming that this error means I need another repository for tidyverse. Here is my current repository, which I got from the Renjin instructions:
<repositories>
<repository>
<id>bedatadriven</id>
<name>bedatadriven public repo</name>
<url>https://nexus.bedatadriven.com/content/groups/public/</url>
</repository>
</repositories>
(here's the link to those instructions as well: http://docs.renjin.org/en/latest/library/project-setup.html#maven)
I am not sure what repository I need to add.
Thank you for reading. I am a beginner, and I really appreciate any and all help.
I am trying to download the latest build of JFXtras (i want the .jar file) but i can't find it.
For 8.0-r6 i can see some .jar.soc .jar.asc what are those files? https://oss.sonatype.org/content/repositories/snapshots/org/jfxtras/jfxtras-all/
For 8.0-r5 a jar exists but it is empty it has only Meta-Inf http://central.maven.org/maven2/org/jfxtras/jfxtras-all/
How to download the jar or build it?And what are those other files there?I haven't seen them again that's why i am asking..
Problem Converting Project to Maven:
The .jar.asc files contain a PGP signature.
To make maven download the jar from maven central, add the dependency to pom.xml, e.g.
<dependencies>
<dependency>
<groupId>org.jfxtras</groupId>
<artifactId>jfxtras-all</artifactId>
<version>8.0-r5</version>
</dependency>
</dependencies>
Or grab the jars manually from http://central.maven.org/maven2/org/jfxtras/ and add them to your project.
If you want to use the bleeding edge snapshot (currently 8.0r6-SNAPSHOT), you'll need to add the sonatype repository to your pom like
<repositories>
<repository>
<id>snapshots-repo</id>
<name>Sonatype Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</repository>
</repositories>
And add the current snapshot to the dependencies, e.g.
<dependencies>
<dependency>
<groupId>org.jfxtras</groupId>
<artifactId>jfxtras-all</artifactId>
<version>8.0-r6-SNAPSHOT</version>
</dependency>
</dependencies>
But be aware that they're development versions (unstable), and their availability in that location can be temporary.
To download the -SNAPSHOT jars manually, you go to the sonata snapshot repository, choose the jfxtras package that you want to download, and scroll down to find the jar. They're simply not keeping all the older snapshots.
I have some local jar files in a folder /src/main/resources/foobar under my basepath.
I have them included as dependencies in my POM.xml:
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.4-SNAPSHOT</version>
</dependency>
Now i tried to add them with a local repository:
<repositories>
<repository>
<id>resource-repository</id>
<url>file://${project.basedir}/repo</url>
</repository>
</repositories>
Now still i get the error message that the jars inside this reposirtory not found:
The following artifacts could not be resolved: bar... in file://.../repo was cached in the local repository, resolution will not be reattempted until the update interval of resource-repository has elapsed or updates are forced -> [Help 1]
I have not used the
mvn install:install-file
command for this. And i would be happy if there is a solution where i dont need to do this.
Edit:
The folder structure is:
repo\io\swagger\swagger-models\1.5.4-SNAPSHOT
and Jar inside:
swagger-models-1.5.4-SNAPSHOT.Jar
Funny though i get a warning about a missing POM from this file when running maven install.
You can declare a Repository for your third party dependencies.
The dependencies must be placed inside the repoBase path and the directory for the jar must follow the pattern: "{groupId}/{artifactId}/{artifactVersion}". Inside this folder the jar has to be named "{artifactId}-{artifactVersion}.jar".
Example:
<dependencies>
<dependency>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>resource-repository</id>
<url>file:${project.basedir}/repo</url>
</repository>
I have this in my pom (and of course the project-tag and group-id etc.)
I then have a directory repo in my project-directory.
In the path "repo\foo\bar\1.0" i then have a "bar-1.0.jar" file inside this directory. This compiles for me (ok, the jar is empty but this does not matter for an example).
Please note that the url for the repository does not contain the two slashes after the "file:".
I hope this example is a little bit more understandable for anyone who tries to this.
I suggest you to use system tag in your dependency tag. Hope it will work.
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 am new to Maven and Codenvy. Trying to build a simple Jar project there. The build fails everytime, although I seem to include all necessary dependencies in pom.xml file.
Here's the project: https://codenvy.com/factory?v=1.0&pname=simplejar&wname=ivantsoft&vcs=git&vcsurl=http%3A%2F%2Fcodenvy.com%2Fgit%2F16%2F81%2F89%2Fworkspacepyk15s4hwbfabmg6%2Fsimplejar&idcommit=2af3588e343317907905b306d7faa3db5674d068&action=openproject&ptype=Jar
In my pom.xml I have:
<repositories>
<repository>
<id>biojava-maven-repo</id>
<name>BioJava repository</name>
<url>http://www.biojava.org/download/maven/</url>
</repository>
</repositories>
...
<dependency>
<groupId>org.biojava</groupId>
<artifactId>biojava3-core</artifactId>
<version>3.0.6</version>
<scope>test</scope>
</dependency>
...
And in my java file I have:
...
import org.biojava3.core.sequence;
...
What am I doing wrong here?
Link is outdated.
INVALID FACTORY URL
The question is to be closed with what chrylis said:
Part of the problem is that your import is wrong; org.biojava3.core.sequence is a package, and you need to import either a specific class from it or org.biojava3.core.sequence.*.