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

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

Related

Spring boot data jpa APPLICATION FAILED TO START

I learn JPA from https://spring.io/guides/gs/accessing-data-jpa/#initial and git clone project
I did a java file following this example but it is still error.
How can I fix it?
-----------
-----------
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-06-09 16:41:37.706 ERROR 18872 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
---------
---------
pom.xml file
http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4.0.0
<groupId>org.springframework</groupId>
<artifactId>gs-accessing-data-jpa</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/libs-release</url>
</repository>
<repository>
<id>org.jboss.repository.releases</id>
<name>JBoss Maven Release Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
You used spring-boot-starter-data-jpa in your pom.xml. But I guess, no data source adjusted in appllication.properties file. If you wanna use DB connections, application.properties file should contain configurations like this:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=mysqluser
spring.datasource.password=mysqlpass
spring.datasource.url=jdbc:mysql://localhost:8080/myDb?createDatabaseIfNotExist=true
Otherwise if you don't use jpa, remove spring-boot-starter-data-jpa dependency from pom.xml:
remove:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
And then try again to run the application.

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!

Maven dependency error (artifact)

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>

Spring boot REST application not working without Build Path in Eclipse

I'm facing an issue where our spring boot application will only run if a subproject is included. A rough project sketch:
Backend
This is where the Main Class is located. This project also contains the spring repository which are exposed via REST, the filters and REST configuration. The data itself is included in the backend-module project.
backend-module
This is where the actual Java Classes which hold the data are located. They are used in conjunction with hibernate.
Now the application works fine unless I remove the backend-module from the Java Build Path in the eclipse Project preferences. But if I remove the reference the application launch will fail but not for a missing component from the backendmodule but for missing spring boot components:
Caused by: java.lang.NoClassDefFoundError: org/springframework/data/repository/support/RepositoryInvokerFactory
The pom.xml files of the project are almost the same.
I'll happily include all the information someone may need.
Thanks
EDIT 1:
The pom.xml of the Backend Project.
<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>backend</groupId>
<artifactId>Backend</artifactId>
<version>1.0</version>
<description>Rest Backend</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.5.RELEASE</version>
</parent>
<properties>
<!-- use UTF-8 for everything -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>cis</groupId>
<artifactId>backend-module</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.2.12.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-spatial</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>1.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>1.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>1.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
<version>1.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-webmvc</artifactId>
<version>2.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-legacy</artifactId>
<version>1.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons-core</artifactId>
<version>1.4.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.2.12.Final</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.1-901-1.jdbc4</version>
</dependency>
<dependency>
<groupId>org.postgis</groupId>
<artifactId>postgis-jdbc</artifactId>
<version>1.5.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>ST4</artifactId>
<version>4.0.8</version>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.5.3</version>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>woodstox-core-asl</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>cis.adapter</groupId>
<artifactId>CISConnector</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>cis.adapter</groupId>
<artifactId>CISCore</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.google</groupId>
<artifactId>caplibrary</artifactId>
<version>r11</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>org.jboss.repository.releases</id>
<name>JBoss Maven Release Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
</repository>
<repository>
<id>OSGEO GeoTools repo</id>
<url>http://download.osgeo.org/webdav/geotools</url>
</repository>
<repository>
<id>Hibernate Spatial repo</id>
<url>http://www.hibernatespatial.org/repository</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-releases</id>
<name>Spring Releases</name>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.2.6.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Apparently the issue was fixed by dropping a lot of the version statements in the pom.xml files and upgrading Spring Boot to the latest version.
If I understood the hastily given explanation correctly our Spring boot release didn't have the right versions of some Spring components packed into it.
Sorry if someone has a similar issue and finds this answer insufficient.