Building a project with Maven in Codenvy - java

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.*.

Related

How can I implement apollographql client into the maven project to activate subscription?

I am trying to create a graphql client in Java project and I am using apollographql library. The problem is that I am not able to get the dependencies using the pom.xml with version different than from Central repository. The other thing is that all of the examples are built with Gradle.
Do you have any examples or ideas about how to create a simple subscription client using apollo library and maven project? One of the specific issues that I have is that once apollographql-runtime library is downloaded there is no "subscription" package.
I wanted to use this dependency:
<dependency>
<groupId>com.apollographql.apollo</groupId>
<artifactId>apollo-runtime</artifactId>
<version>1.0.0-alpha5</version>
</dependency>
but I am not able to download it using pom.xml.
In a different project, it was working with gradle.build file.
tried download .jar file but still no "subscription" package available.
pom.xml
<dependency>
<groupId>com.apollographql.apollo</groupId>
<artifactId>apollo-runtime</artifactId>
<version>1.0.0-alpha5</version>
<type>pom</type>
</dependency>
I want to import this class:
import com.apollographql.apollo.subscription.WebSocketSubscriptionTransport;
Could not resolve dependencies for project com.brzozaxd.rbpvendor2:rbpvendor2:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: com.apollographql.apollo:apollo-api:jar:1.0.0-alpha5
Works for me, and has the mentioned package and class inside it.
<project>
....
<repositories>
<repository>
<id>repo2</id>
<name>appolographql repo</name>
<url>https://dl.bintray.com/apollographql/android</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.apollographql.apollo</groupId>
<artifactId>apollo-runtime</artifactId>
<version>1.0.0-alpha5</version>
</dependency>
</dependencies>
</project>

Can not import WebSocketStompClient class - STOMP + SockJS java Client

I am trying to create Java WebSocket client (STOMP + sockJs) following
this sample. But I am not able to find maven/gradle dependency for
org.springframework.web.socket.messaging.WebSocketStompClient
Even maven search did not give any results.
After some searching I found that this is a part of
4.2.0.BUILD-SNAPSHOT
and the javadoc for this class is here.
I have tried to import
org.springframework:spring-messaging:4.2.0.BUILD-SNAPSHOT
and
org.springframework:spring-web:4.2.0.BUILD-SNAPSHOT
But I was not able to import this class.
I want to know if it is possible to import the 4.2.0.BUILd-SNAPSHOT from gradle.
If it is possible how do I know which spring module (like spring-web / spring-messaging) from the javadoc?
EDIT : am I correct in assuming that it is part of 4.2.0 from the Javadoc URL?
You need to add the snapshot repository if you want to use them:
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.2.0.BUILD-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>http://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
Please add this in your POM.xml :Please match the version with your Spring-framework version.
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
<version>4.0.0.RELEASE</version>
</dependency>
Then do a mvn clean && mvn install from console if you are on linux or maven install from Eclipse.
I was not able to import 4.2.0.BUILD-SNAPSHOT but I was able to import 4.2.0.RC1 release.
I checked the pom.xml of the sample and just imported the same version as it is.

Maven. Adding maven repository for activiti

The problem is that I'm trying to make somelike the helloworld with Activiti but I have an error here
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>5.1</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring</artifactId>
<version>5.1</version>
</dependency>
the error is the following: 'Description Resource Path Location Type
Missing artifact org.activiti:activiti-engine:jar:5.1 pom.xml /IllMakeThisTestApp line 29 Maven Dependency Problem
Trying to resolve it I've found the following recomendation here: "The download contains all the libraries that you need to work with Activiti. But for developers that prefer to use Maven, add the following reposiory"
<repositories>
<repository>
<id>Alfresco Maven Repository</id>
<url>https://maven.alfresco.com/nexus/content/groups/public/</url>
</repository>
</repositories>
But where shall I place it? To the file called settings.ini placed in M2_HOME/conf? This file is full of comments with no any sign of repositories. So I have no idea how to do this and ask you for help
You should place that in your pom.xml - see the Maven reference on the subject:
<project xmlns="http://maven.apache.org/POM/4.0.0"...
...
<repositories>
<repository>
<id>Alfresco Maven Repository</id>
...
You will only need to tinker with the Maven config if you need to setup a mirror for the repo, eg. in case your organisation has it's own Nexus/other repo mirroring the outside "world".
Cheers,
You can place right under project. For example
<project>
....
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</project>
In default maven will try to download all the artifacts from maven central. You can add any number of added repositories using tag given above. Alfresco is yet another open maven repository.

Loading Maven dependencies from GitHub [duplicate]

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.

Import and use a class from a jar using Maven

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.

Categories

Resources