Maven dependency error (artifact) - eclipse

I'm trying to install Fenix framework with maven adding the following dependence:
<dependency>
<groupId>pt.ist</groupId>
<artifactId>fenix-framework-backend-infinispan</artifactId>
<version>2.0-cloudtm</version>
</dependency>
gives the following error: missing artifact ...
My POM.xml :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.isban.test</groupId>
<artifactId>fenixtest</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>fenixtest</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>pt.ist</groupId>
<artifactId>fenix-framework-backend-infinispan</artifactId>
<version>2.0-cloudtm</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<pluginRepositories>
<pluginRepository>
<id>fenix-ashes-maven-repository</id>
<url>https://fenix-ashes.ist.utl.pt/maven-public</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>fenix-ashes-maven-repository</id>
<url>https://fenix-ashes.ist.utl.pt/maven-public</url>
</repository>
</repositories>
</project>
Official documentation : https://fenix-framework.github.io/Usage.html
Does anyone know what I'm doing wrong?

Those artifacts are not available on Maven Central but on a specific Fénix repository. From the official page:
These artifacts are available via the Fénix Framework Nexus repository, so you need to add it to your configuration:
<pluginRepositories>
<pluginRepository>
<id>fenix-ashes-maven-repository</id>
<url>https://fenix-ashes.ist.utl.pt/maven-public</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>fenix-ashes-maven-repository</id>
<url>https://fenix-ashes.ist.utl.pt/maven-public</url>
</repository>
</repositories>
There is actually a typo in that page, that I corrected here: the last element should be <repositories> and not <pluginRepositories>. Therefore, you need to add those repositories to your POM (or to your Maven settings).
The dependency
<dependency>
<groupId>pt.ist</groupId>
<artifactId>fenix-framework-backend-infinispan</artifactId>
<version>2.0-cloudtm</version>
</dependency>
is also incorrect from the documentation: that artifact indeed doesn't exist. The latest version is 2.6.2 and the artifact should be fenix-framework-backend-infinispan-code-generator, so you should have instead:
<dependency>
<groupId>pt.ist</groupId>
<artifactId>fenix-framework-backend-infinispan-code-generator</artifactId>
<version>2.6.2</version>
</dependency>

Related

Maven can't find artifact for Spring Boot 2.0.0.M2 in Spring Repo

Discovered that to use Spring Data ElasticSearch with ElasticSearch 5.5.0 that you need to use Spring Boot's 2.0.0.M2 milestone... However, something is wrong with my pom where maven can't seem to find the Spring Boot 2.0.0.M2 milestone from the Maven repositories that I specified.
pom.xml:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.M2</version>
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<!-- Elasticsearch -->
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot</artifactId>
<version>2.0.0.M2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
<version>2.0.0.M2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Package as an executable jar/war -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-libs-snapshot</id>
<name>Spring Snapshot Repository</name>
<url>http://repo.spring.io/libs-snapshot</url>
</repository>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
Received the following problem when doing a Maven -> Update Project in Eclipse:
Maven pom Loading Problem: Could not find artifact org.springframework.boot:spring-boot-maven-plugin:jar:2.0.0.M2 in spring-releases (https://repo.spring.io/libs-release) pom.xml
For milestone versions you have to add the milestone repository with the URL https://repo.spring.io/libs-milestone/.

How to resolve 'Offline / Missing artifact org.geotools:gt-shapefile:jar:17-SNAPSHOT' in Maven?

I'm new to Maven and am trying to create a simple Maven project given in geotools.org
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- use the latest snapshot -->
<geotools.version>17-SNAPSHOT</geotools.version>
</properties>
<groupId>org.geotools</groupId>
<artifactId>tutorial</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>tutorial</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-shapefile</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-swing</artifactId>
<version>${geotools.version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net repository</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>osgeo</id>
<name>Open Source Geospatial Foundation Repository</name>
<url>http://download.osgeo.org/webdav/geotools/</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>boundless</id>
<name>Boundless Maven Repository</name>
<url>http://repo.boundlessgeo.com/main</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
The error I am getting is 'Offline / Missing artifact org.geotools:gt-shapefile:jar:17-SNAPSHOT'. How do I resolve this? I am using Eclipse Neon.1a Release (4.6.1).There is no option for selecting Project ‣ Update All Maven Dependencies. In some of the similar questions asked here it was recommended to change the repository URL. Which URL shall I change? Java.net repository OR Open Source Geospatial Foundation Repository OR Boundless Maven Repository?
It looks like the Boundless artifactory was down at that moment. For the time being you can use version 16-RC1 as the latest released version, 15.2 as the last stable release.
If you absolutely must be on the cutting edge, I'd recommend downloading/cloning master and building it locally.
I think that instead of ${geotools.version} you should place a real version number of the project, like 15.1
I am not sure though if that's the problem
Also, you might want to consider changing to Gradle build. I think it is a lot simpler

NoClassDefFoundError: HikariCP with Maven

I'm creating a Maven plugin (to hook into Spigot/Bukkit/BungeeCord) and am attempting to connect to a database. On startup, I get this error:
Exception encountered when loading plugin: WarCore
java.lang.NoClassDefFoundError: com/zaxxer/hikari/HikariDataSource
I've tried using the Maven dependency plugin, Maven assembly plugin, but I cannot find a solution.
Here's my current pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>net.braden.warcoreproxy</groupId>
<artifactId>WarCoreProxy</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>WarCoreProxy</name>
<description>WarCoreProxy</description>
<repositories>
<repository>
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<repository>
<id>confuser-repo</id>
<url>http://ci.frostcast.net/plugin/repository/everything</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>me.confuser</groupId>
<artifactId>BanManager</artifactId>
<version>5.10.0</version>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.9-SNAPSHOT</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.9-SNAPSHOT</version>
<type>javadoc</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.4.7</version>
</dependency>
</dependencies>
</project>
Let me know if you have any solutions, thanks in advance!

SEVERE: Servlet /JAXRS-HelloWorld threw load() exception java.lang.ClassNotFoundException: com.sun.jersey.spi.container.servlet.ServletContainer

I read through plenty of posts related to this issue but couldn't get any help .
ERROR
Appreciate if someone can help me out.
enter image description here
This is how my POM and web looks like . I have tried copying the required war file to C:\appache tomcat 7 but no luck. Even deploying it within the eclipse also gives me the same error.
WEb
enter image description here
POM.xML:-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.tutorialacademy.rest</groupId>
<artifactId>helloworld</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>helloworld Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>maven2-repository.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-apache-client</artifactId>
<version>1.19</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
By the exception, it looks like the com.sun.jersey.spi.container.servlet.ServletContainer class is not available in your classpath.
Note that Jersey 1.x and Jersey 2.x use different package names:
Jersey 1.x: com.sun.jersey
Jersey 2.x: org.glassfish.jersey
So, I understand you are using Jersey 1.x.
Jersey 1.x depencency
To use Jersey 1.x, you need the following dependecy in your pom.xml:
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.19</version>
</dependency>
To read more about Jersey 1.x dependencies, have a look at the documentation.
You can check the latest version of the jersey-server artifactId in the Maven Repository.
Jersey 2.x depencency
If you want to use Jersey 2.x, you have to add the following dependency to your pom.xml:
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<!-- if your container implements Servlet API older than 3.0,
use "jersey-container-servlet-core" -->
<artifactId>jersey-container-servlet</artifactId>
<version>2.22.1</version>
</dependency>
You can check the latest version of the jersey-container-servlet artifactId in the Maven Repository.
Read more about Jersey 2.x dependencies in the documentation.
UPDATE
If you can, I do recommend using Jersey 2.x rather than Jersey 1.x.
To do it, use the following pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.tutorialacademy.rest</groupId>
<artifactId>helloworld</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Hello World</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>maven2-repository.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<!-- if your container implements Servlet API older than 3.0,
use "jersey-container-servlet-core" -->
<artifactId>jersey-container-servlet</artifactId>
<version>2.22.1</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
And the following web.xml:
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
</web-app>
If you are trying to make a Web application to provide web service using Jersey library in Tomcat and Eclipse and still getting problem after adding jersey-server.jar in the classpath. You can follow these steps to add dependency on deployment assembly.
Project -> properties -> development assembly -> add -> java build path entries -> maven dependency
This should work.

How to add Spark to Maven project in Eclipse?

I would like to start Spark project in Eclipse using Maven.
I've installed m2eclipse and I have a working HelloWorld Java application in my Maven project.
I would like to use Spark framework and I'm following directions from the official site.
I've added Spark repository to my pom.xml:
<repository>
<id>Spark repository</id>
<url>http://www.sparkjava.com/nexus/content/repositories/spark/</url>
</repository>
And then the dependency:
<dependency>
<groupId>spark</groupId>
<artifactId>spark</artifactId>
<version>0.9.9.4-SNAPSHOT</version>
</dependency>
But I'm getting an error in Eclipse:
Missing artifact spark:spark:jar:0.9.9.4-SNAPSHOT
How can I resolve this issue? I don't want to download Spark's jar file and place in the local repository.
This is my pom.xml file:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myproject</groupId>
<artifactId>Spark1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Spark1</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repository>
<id>Spark repository</id>
<url>http://www.sparkjava.com/nexus/content/repositories/spark/</url>
</repository>
<dependencies>
<!-- (...) -->
<dependency>
<groupId>spark</groupId>
<artifactId>spark</artifactId>
<version>0.9.9.4-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
Currently no repository is required to add for Spark library loading
You just need to add
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.6.0</version>
</dependency>
And that's it.
Useful tutorials to play with is here
The repository block needs to be wrapped in a repositories block:
<repositories>
<repository>
<id>Spark repository</id>
<url>http://www.sparkjava.com/nexus/content/repositories/spark/</url>
</repository>
</repositories>
Reason for failure is 0.9.9.4-SNAPSHOT is not available.Below is the list of the snapshots available. Use one among them based on your requirement.
0.9.8-SNAPSHOT/ Sat May 21 21:54:23 UTC 2011
0.9.9-SNAPSHOT/ Mon May 23 10:57:38 UTC 2011
0.9.9.1-SNAPSHOT/ Thu May 26 09:47:03 UTC 2011
0.9.9.3-SNAPSHOT/ Thu Sep 01 07:53:59 UTC 2011
Thanks,
Sankara Reddy
I had run into same issue because initially I started with different repository url for spark and then to use earlier version I changed the repository url. Some how it didn't seem to come into effect until I changed the repository id. Try changing the repository id.
Could be bug in maven because running maven from console also couldn't resolve the dependency without updating the id.
please add the repository , tag inside the repositories tag like below
<repositories>
<repository>
<id>Spark repository</id>
<url>http://www.sparkjava.com/nexus/content/repositories/spark/</url>
</repository>
</repositories>
The last versions (2.1 and later) of Spark only need the dependency defined inside the pom.xml file
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.1</version>
</dependency>
the repository definition is not longer required
use this latest repository.
http://mvnrepository.com/artifact/org.apache.spark/spark-core_2.10/1.6.0
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.6.0</version>
</dependency>
use this, and also make sure you change spark library to version 2.11.x in eclipse project build path
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.spark-scala</groupId>
<artifactId>spark-scala</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>Spark in Scala</description>
<inceptionYear>2010</inceptionYear>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<encoding>UTF-8</encoding>
<scala.tools.version>2.10</scala.tools.version>
<!-- Put the Scala version of the cluster -->
<scala.version>2.10.4</scala.version>
</properties>
<!-- repository to add org.apache.spark -->
<repositories>
<repository>
<id>cloudera-repo-releases</id>
<url>https://repository.cloudera.com/artifactory/repo/</url>
</repository>
</repositories>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<!-- see http://davidb.github.com/scala-maven-plugin -->
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.13</version>
<configuration>
<useFile>false</useFile>
<disableXmlReport>true</disableXmlReport>
<includes>
<include>**/*Test.*</include>
<include>**/*Suite.*</include>
</includes>
</configuration>
</plugin>
<!-- "package" command plugin -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies>
</project>