Running project in IntelliJ - java

I have one application based on Maven + Spring.
It's a Java web application using java.
this is the pom.xml i'm using:
<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.alfred</groupId>
<artifactId>alfred</artifactId>
<version>v.0.1-CID.Fase.II.Edesk-SNAPSHOT</version>
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.7.RELEASE</version>
</parent>
<name>ALFRED</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0.4.0</version>
</dependency>
<!-- Dependencia para Spring DATA JPA con base de datos -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- Para implementar las conexiones a la base de datos MySQL -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<!-- version>5.1.35</version -->
</dependency>
<!-- Para implementar el servicio REST -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<!-- http://mvnrepository.com/artifact/com.google.code.gson/gson -->
<!-- Paquete que permite convertir el contenido de una respuesta en texto
plano JSON a objetos Java. -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<!-- Para implementar cliente REST con Template -->
<!-- dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId>
</dependency -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- Para implementar las plantillas HTML con thymeleaf -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.thymeleaf.extras/thymeleaf-extras-springsecurity3 -->
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity3</artifactId>
</dependency>
<!-- Para poder implementar los clientes de los servicios REST -->
<dependency>
<groupId>com.squareup.retrofit</groupId>
<artifactId>retrofit</artifactId>
<version>1.7.1</version>
</dependency>
<!-- Para escapar HTML en las llamadas a la API de IMDB -->
<!-- http://mvnrepository.com/artifact/commons-httpclient/commons-httpclient -->
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.0</version>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- Java Mail API -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.security/spring-security-ldap -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
<version>4.2.0.RELEASE</version>
</dependency>
<!-- Librería para tratar con excels -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.16</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!--<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId>
<configuration> DO NOT include log4j.properties file in your Jar <excludes>
<exclude>**/log4j.properties</exclude> </excludes> <archive> </archive> </configuration>
</plugin> -->
</plugins>
</build>
</project>
When I do the clean, generate resources and install appear this error and not start working
"C:\Program Files\Java\jdk1.8.0_151\bin\java"
-Dmaven.multiModuleProjectDirectory=C:\Users\spainasg\Documents\CID_UAT
-Dmaven.home=C:\Users\spainasg\Downloads\apache-maven-3.5.2-bin\apache-maven-3.5.2 -Dclassworlds.conf=C:\Users\spainasg\Downloads\apache-maven-3.5.2-bin\apache-maven-3.5.2\bin\m2.conf
-Dfile.encoding=UTF-8 -classpath C:\Users\spainasg\Downloads\apache-maven-3.5.2-bin\apache-maven-3.5.2\boot\plexus-classworlds-2.5.2.jar
org.codehaus.classworlds.Launcher -Didea.version=2017.2.6 --offline -s
C:\Users\spainasg.m2\settings.xml
-Dmaven.repo.local=C:\Users\spainasg.m2\repository clean generate-resources install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
com.alfred:alfred:war:v.0.1-CID.Fase.II.Edesk-SNAPSHOT
[WARNING] Detected profiles.xml alongside com.alfred:alfred:v.0.1-CID.Fase.II.Edesk-SNAPSHOT, this file is no
longer supported and was ignored, please use the settings.xml instead
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ALFRED v.0.1-CID.Fase.II.Edesk-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.apache.maven.plugins:maven-install-plugin:jar:2.5.2 is missing, no
dependency information available
[WARNING] The POM for com.oracle:ojdbc14:jar:10.2.0.4.0 is missing, no dependency information available
[WARNING] The POM for org.thymeleaf.extras:thymeleaf-extras-springsecurity3:jar:2.1.2.RELEASE
is missing, no dependency information available
[WARNING] The POM for org.apache.poi:poi:jar:3.16 is missing, no dependency information available
[WARNING] The POM for org.apache.poi:poi-ooxml-schemas:jar:3.16 is missing, no dependency information available
[WARNING] The POM for com.github.virtuald:curvesapi:jar:1.04 is missing, no dependency information available
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # alfred ---
[INFO] Deleting C:\Users\spainasg\Documents\CID_UAT\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # alfred ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 90 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # alfred ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 174 source files to C:\Users\spainasg\Documents\CID_UAT\target\classes
[WARNING] /C:/Users/spainasg/Documents/CID_UAT/src/main/java/com/edesk/controladorGUI/GestionServicioAprobadorController.java:
C:\Users\spainasg\Documents\CID_UAT\src\main\java\com\edesk\controladorGUI\GestionServicioAprobadorController.java
uses unchecked or unsafe operations.
[WARNING] /C:/Users/spainasg/Documents/CID_UAT/src/main/java/com/edesk/controladorGUI/GestionServicioAprobadorController.java:
Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # alfred ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\spainasg\Documents\CID_UAT\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # alfred ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) # alfred ---
[WARNING] The POM for org.apache.maven.surefire:maven-surefire-common:jar:2.17 is missing,
no dependency information available
[WARNING] The POM for org.apache.maven.surefire:surefire-api:jar:2.17 is missing, no
dependency information available
[WARNING] The POM for org.apache.maven:maven-toolchain:jar:2.0.9 is missing, no dependency information available
[WARNING] The POM for org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.2 is
missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.961 s
[INFO] Finished at: 2017-11-30T09:45:30+01:00
[INFO] Final Memory: 29M/233M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test
(default-test) on project alfred: Execution default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed:
Plugin org.apache.maven.plugins:maven-surefire-plugin:2.17 or one of
its dependencies could not be resolved: The following artifacts could
not be resolved:
org.apache.maven.surefire:maven-surefire-common:jar:2.17,
org.apache.maven.surefire:surefire-api:jar:2.17,
org.apache.maven:maven-toolchain:jar:2.0.9,
org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.2,
org.codehaus.plexus:plexus-utils:jar:1.1: Cannot access central
(https://repo.maven.apache.org/maven2) in offline mode and the
artifact org.apache.maven.surefire:maven-surefire-common:jar:2.17 has
not been downloaded from it before. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
[ERROR] Maven execution terminated abnormally (exit code 1)
I'm using IntelliJ, but have the same error using Eclipse.
The aplications are working offline.
Any idea for this solution?

Try to add all your missing dependencies.
[WARNING] The POM for org.apache.maven.surefire:maven-surefire-common:jar:2.17 is missing, no dependency information available
[WARNING] The POM for org.apache.maven.surefire:surefire-api:jar:2.17 is missing, no dependency information available
[WARNING] The POM for org.apache.maven:maven-toolchain:jar:2.0.9 is missing, no dependency information available
[WARNING] The POM for org.apache.maven.plugin-tools:maven-plugin-annotations:jar:3.2 is missing, no dependency information available

Related

Maven Shading Multi-Module Aggregation and Inheritance

Context
I have an IntelliJ project with multiple modules. I am using the maven-shade-plugin to jar with dependencies whilst reducing jar size. The project structure is as follows;
top-level parent (pom) (aggregates api and world-teleport)
api (inherits parent)
world-teleport (inherits parent, api)
Pom(s)
Parent
<groupId>com.jsonmack</groupId>
<artifactId>mcplugins</artifactId>
<packaging>pom</packaging>
<version>1.10-SNAPSHOT</version>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<modules>
<module>api</module>
<module>world-teleport</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<artifactSet>
<excludes>
<exclude>junit:junit</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<version>4.8.68</version>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15.2-R0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
api
<parent>
<artifactId>mcplugins</artifactId>
<groupId>com.jsonmack</groupId>
<version>1.10-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>api</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
</dependency>
</dependencies>
world-teleport
<parent>
<groupId>com.jsonmack</groupId>
<artifactId>mcplugins</artifactId>
<version>1.10-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>com.jsonmack</groupId>
<artifactId>api</artifactId>
<version>1.10-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
The problem
Everytime I perform a clean and a new install or package it is indicated to me that there are duplicate dependencies.
The error/warning(s)
[INFO]
[INFO] --------------------< com.jsonmack:world_teleport >---------------------
[INFO] Building world_teleport 1.8-SNAPSHOT [7/7]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # world_teleport ---
[INFO] Deleting /Users/Business/Documents/workspace/mcplugins/world_teleport/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # world_teleport ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # world_teleport ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 19 source files to /Users/Business/Documents/workspace/mcplugins/world_teleport/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # world_teleport ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/Business/Documents/workspace/mcplugins/world_teleport/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) # world_teleport ---
[INFO] Changes detected - recompiling the module!
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # world_teleport ---
[INFO]
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) # world_teleport ---
[INFO] Building jar: /Users/Business/Documents/workspace/mcplugins/world_teleport/target/world_teleport-1.8-SNAPSHOT.jar
[INFO]
[INFO] --- maven-shade-plugin:3.2.2:shade (default) # world_teleport ---
[INFO] Including com.jsonmack:api:jar:1.10-SNAPSHOT in the shaded jar.
[INFO] Including io.github.classgraph:classgraph:jar:4.8.68 in the shaded jar.
[INFO] Including org.spigotmc:spigot-api:jar:1.15.2-R0.1-SNAPSHOT in the shaded jar.
[INFO] Including commons-lang:commons-lang:jar:2.6 in the shaded jar.
[INFO] Including com.google.guava:guava:jar:21.0 in the shaded jar.
[INFO] Including com.google.code.gson:gson:jar:2.8.0 in the shaded jar.
[INFO] Including net.md-5:bungeecord-chat:jar:1.15-SNAPSHOT in the shaded jar.
[INFO] Including org.yaml:snakeyaml:jar:1.25 in the shaded jar.
[INFO] Minimizing jar com.jsonmack:world_teleport:jar:1.8-SNAPSHOT
[WARNING] /Users/Business/Documents/workspace/mcplugins/world_teleport/target/classes (Is a directory)
[WARNING] api-1.10-SNAPSHOT.jar, snakeyaml-1.25.jar define 207 overlapping classes and resources:
[WARNING] - META-INF/maven/org.yaml/snakeyaml/pom.properties
[WARNING] - META-INF/maven/org.yaml/snakeyaml/pom.xml
[WARNING] - org.yaml.snakeyaml.DumperOptions
[WARNING] - org.yaml.snakeyaml.DumperOptions$FlowStyle
[WARNING] - org.yaml.snakeyaml.DumperOptions$LineBreak
[WARNING] - org.yaml.snakeyaml.DumperOptions$NonPrintableStyle
[WARNING] - org.yaml.snakeyaml.DumperOptions$ScalarStyle
[WARNING] - org.yaml.snakeyaml.DumperOptions$Version
[WARNING] - org.yaml.snakeyaml.LoaderOptions
[WARNING] - org.yaml.snakeyaml.TypeDescription
[WARNING] - 197 more...
[WARNING] api-1.10-SNAPSHOT.jar, guava-21.0.jar define 931 overlapping classes and resources:
[WARNING] - META-INF/maven/com.google.guava/guava/pom.properties
[WARNING] - META-INF/maven/com.google.guava/guava/pom.xml
[WARNING] - com.google.common.annotations.Beta
[WARNING] - com.google.common.annotations.GwtCompatible
[WARNING] - com.google.common.annotations.GwtIncompatible
[WARNING] - com.google.common.annotations.VisibleForTesting
[WARNING] - com.google.common.base.Absent
[WARNING] - com.google.common.base.AbstractIterator
[WARNING] - com.google.common.base.AbstractIterator$1
[WARNING] - com.google.common.base.AbstractIterator$State
[WARNING] - 921 more...
[WARNING] api-1.10-SNAPSHOT.jar, gson-2.8.0.jar define 161 overlapping classes and resources:
[WARNING] - META-INF/maven/com.google.code.gson/gson/pom.properties
[WARNING] - META-INF/maven/com.google.code.gson/gson/pom.xml
[WARNING] - com.google.gson.ExclusionStrategy
[WARNING] - com.google.gson.FieldAttributes
[WARNING] - com.google.gson.FieldNamingPolicy
[WARNING] - com.google.gson.FieldNamingPolicy$1
[WARNING] - com.google.gson.FieldNamingPolicy$2
[WARNING] - com.google.gson.FieldNamingPolicy$3
[WARNING] - com.google.gson.FieldNamingPolicy$4
[WARNING] - com.google.gson.FieldNamingPolicy$5
[WARNING] - 151 more...
[WARNING] api-1.10-SNAPSHOT.jar, bungeecord-chat-1.15-SNAPSHOT.jar define 17 overlapping classes and resources:
[WARNING] - META-INF/maven/net.md-5/bungeecord-chat/pom.properties
[WARNING] - META-INF/maven/net.md-5/bungeecord-chat/pom.xml
[WARNING] - mojang-translations/en_US.properties
[WARNING] - mojang-translations/en_us.json
[WARNING] - net.md_5.bungee.api.ChatColor
[WARNING] - net.md_5.bungee.api.ChatMessageType
[WARNING] - net.md_5.bungee.api.chat.BaseComponent
[WARNING] - net.md_5.bungee.api.chat.ClickEvent
[WARNING] - net.md_5.bungee.api.chat.ClickEvent$Action
[WARNING] - net.md_5.bungee.api.chat.ComponentBuilder
[WARNING] - 7 more...
[WARNING] api-1.10-SNAPSHOT.jar, commons-lang-2.6.jar define 63 overlapping classes and resources:
[WARNING] - META-INF/LICENSE.txt
[WARNING] - META-INF/NOTICE.txt
[WARNING] - META-INF/maven/commons-lang/commons-lang/pom.properties
[WARNING] - META-INF/maven/commons-lang/commons-lang/pom.xml
[WARNING] - org.apache.commons.lang.ArrayUtils
[WARNING] - org.apache.commons.lang.BooleanUtils
[WARNING] - org.apache.commons.lang.CharRange
[WARNING] - org.apache.commons.lang.CharRange$1
[WARNING] - org.apache.commons.lang.CharRange$CharacterIterator
[WARNING] - org.apache.commons.lang.CharSet
[WARNING] - 53 more...
[WARNING] api-1.10-SNAPSHOT.jar, bungeecord-chat-1.15-SNAPSHOT.jar, classgraph-4.8.68.jar, commons-lang-2.6.jar, gson-2.8.0.jar, guava-21.0.jar, snakeyaml-1.25.jar, spigot-api-1.15.2-R0.1-SNAPSHOT.jar, world_teleport-1.8-SNAPSHOT.jar define 1 overlapping resources:
[WARNING] - META-INF/MANIFEST.MF
[WARNING] api-1.10-SNAPSHOT.jar, spigot-api-1.15.2-R0.1-SNAPSHOT.jar define 710 overlapping classes and resources:
[WARNING] - META-INF/maven/org.spigotmc/spigot-api/pom.properties
[WARNING] - META-INF/maven/org.spigotmc/spigot-api/pom.xml
[WARNING] - org.bukkit.Art
[WARNING] - org.bukkit.Axis
[WARNING] - org.bukkit.BanEntry
[WARNING] - org.bukkit.BanList
[WARNING] - org.bukkit.BanList$Type
[WARNING] - org.bukkit.BlockChangeDelegate
[WARNING] - org.bukkit.Bukkit
[WARNING] - org.bukkit.ChatColor
[WARNING] - 700 more...
[WARNING] api-1.10-SNAPSHOT.jar, classgraph-4.8.68.jar define 228 overlapping classes and resources:
[WARNING] - LICENSE-ClassGraph.txt
[WARNING] - META-INF.versions.9.module-info
[WARNING] - META-INF/maven/io.github.classgraph/classgraph/pom.properties
[WARNING] - META-INF/maven/io.github.classgraph/classgraph/pom.xml
[WARNING] - io.github.classgraph.AnnotationClassRef
[WARNING] - io.github.classgraph.AnnotationEnumValue
[WARNING] - io.github.classgraph.AnnotationInfo
[WARNING] - io.github.classgraph.AnnotationInfo$AnnotationInvocationHandler
[WARNING] - io.github.classgraph.AnnotationInfoList
[WARNING] - io.github.classgraph.AnnotationInfoList$AnnotationInfoFilter
[WARNING] - 218 more...
[WARNING] maven-shade-plugin has detected that some class files are
[WARNING] present in two or more JARs. When this happens, only one
[WARNING] single version of the class is copied to the uber jar.
[WARNING] Usually this is not harmful and you can skip these warnings,
[WARNING] otherwise try to manually exclude artifacts based on
[WARNING] mvn dependency:tree -Ddetail=true and the above output.
[WARNING] See http://maven.apache.org/plugins/maven-shade-plugin/
[INFO] Minimized 6106 -> 4706 (77%)
Question
What is causing this warning? What if anything is wrong with my maven pom structure?
Duplicate Question
If this is a duplicate question please feel free to provide any resources, they would be greatly appreciated.
I think the problem is that you have the io.github.classgraph and the org.spigotmc dependency added in the api and the module-1 as well.
So what happens:
The api module will generate the jar artifact with
io.github.classgraphand the org.spigotmc dependencies included in it.
The module-1 modul which depends on the api module will import the
jar file.
Now the module-1 module has the io.github.classgraphand the org.spigotmc dependency
from the jar, and they are declared again in the module-1 module's
pom.xml file.
So the solution will be to remove the io.github.classgraph and the org.spigotmc dependency from your module-1 module pom.xml:
<parent>
<groupId>com.jsonmack</groupId>
<artifactId>mcplugins</artifactId>
<version>1.10-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>com.jsonmack</groupId>
<artifactId>api</artifactId>
<version>1.10-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
Well here I would like to appreciate your proactive was of noticing that as many developers keep on adding decencies and do not bother about such warnings.
Answer my question, as you have three different modules. Will those modules be deployed differently (independently) or together in one war or jar or package?
If your answer is yes here is nothing to worry.
If your answer is no then
I see io.github dependency as redundant just get rid of it.
Delete the redundant dependencies from child module or referenced module.
Sorry if there are typos, answered in mobile but will do the job for you.
An other idea:
Try removing io.github.classgraph and the org.spigotmc dependencies from the parent pom as well.
Parent
<groupId>com.jsonmack</groupId>
<artifactId>mcplugins</artifactId>
<packaging>pom</packaging>
<version>1.10-SNAPSHOT</version>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<modules>
<module>api</module>
<module>world-teleport</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
<version>3.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<artifactSet>
<excludes>
<exclude>junit:junit</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
world-teleport
<parent>
<groupId>com.jsonmack</groupId>
<artifactId>mcplugins</artifactId>
<version>1.10-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
<groupId>com.jsonmack</groupId>
<artifactId>api</artifactId>
<version>1.10-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
</dependencies>
Thank you for the help everyone. I have found the solution which is that the API module should inherit the dependencies such as spigot and classgraph from parent but the scope of those dependencies should only be provided. This will allow the dependencies to compile but be excluded from packaging when shading. This is possible because API will not be used outside of these modules, so the API will always have the dependencies required through the other modules.
api-module.pom
<dependencies>
<dependency>
<groupId>io.github.classgraph</groupId>
<artifactId>classgraph</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

problems trying to install ojdbc7 as a maven dependency [duplicate]

This question already has answers here:
Find Oracle JDBC driver in Maven repository
(21 answers)
Closed 3 years ago.
I am having problems trying to build my project with maven, more specifically when a dependency is required, that of Oracle JDBC 7, I have been looking for a solution for hours and nothing, even consult some of the questions raised regarding that here but nothing
C:\Users\E10697\Desktop\Contenedores\oracle_contenedores\Entorno-Oracle-sobre-Docker-master\4. Consumo de la Oracle DB a través de un API Rest\4.1. Elaboración del API Rest\4.1.2. Implementación de una API Rest\OpenwebinarDockerAPI - RESUELTO\OPENWE~1>mvn clean install
error: [ERROR] Failed to execute goal on project app-rest-api: Could not resolve dependencies for project openwebinar.marvel.app:app-rest-api:war:0.1.0-SNAPSHOT: Could not find artifact com.oracle:ojdbc7:jar:12.1.0 in spring-milestones (https://repo.spring.io/milestone)
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] rest-api [pom]
[INFO] app-rest-api [war]
[INFO] app-web [war]
[INFO]
[INFO] ---------------------< openwebinar.marvel.app:app >---------------------
[INFO] Building rest-api 0.1.0-SNAPSHOT [1/3]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) # app ---
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) # app ---
[INFO] Installing C:\Users\E10697\Desktop\Contenedores\oracle_contenedores\Entorno-Oracle-sobre-Docker-master\4. Consumo de la Oracle DB a través de un API Rest\4.1. Elaboración del API Rest\4.1.2. Implementación de una API Rest\OpenwebinarDockerAPI - RESUELTO\OPENWE~1\pom.xml to C:\Users\E10697\.m2\repository\openwebinar\marvel\app\app\0.1.0-SNAPSHOT\app-0.1.0-SNAPSHOT.pom
[INFO]
[INFO] ----------------< openwebinar.marvel.app:app-rest-api >-----------------
[INFO] Building app-rest-api 0.1.0-SNAPSHOT [2/3]
[INFO] --------------------------------[ war ]---------------------------------
Downloading from spring-milestones: https://repo.spring.io/milestone/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.pom
Downloading from repository.springframework.maven.release: http://maven.springframework.org/milestone/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.pom
Downloading from org.springframework: http://maven.springframework.org/snapshot/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.pom
Downloading from spring-milestone: http://repo.spring.io/libs-milestone/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.pom
Downloading from spring-release: http://repo.spring.io/libs-release/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.pom
Downloading from central: https://repo.maven.apache.org/maven2/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.pom
[WARNING] The POM for com.oracle:ojdbc7:jar:12.1.0 is missing, no dependency information available
Downloading from spring-milestones: https://repo.spring.io/milestone/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.jar
Downloading from repository.springframework.maven.release: http://maven.springframework.org/milestone/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.jar
Downloading from org.springframework: http://maven.springframework.org/snapshot/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.jar
Downloading from spring-milestone: http://repo.spring.io/libs-milestone/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.jar
Downloading from spring-release: http://repo.spring.io/libs-release/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.jar
Downloading from central: https://repo.maven.apache.org/maven2/com/oracle/ojdbc7/12.1.0/ojdbc7-12.1.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for rest-api 0.1.0-SNAPSHOT:
[INFO]
[INFO] rest-api ........................................... SUCCESS [ 0.590 s]
[INFO] app-rest-api ....................................... FAILURE [ 3.732 s]
[INFO] app-web ............................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.762 s
[INFO] Finished at: 2020-01-03T15:36:54-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project app-rest-api: Could not resolve dependencies for project openwebinar.marvel.app:app-rest-api:war:0.1.0-SNAPSHOT: Could not find artifact com.oracle:ojdbc7:jar:12.1.0 in spring-milestones (https://repo.spring.io/milestone) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <args> -rf :app-rest-api
The app-rest-api pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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>
<artifactId>app-rest-api</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>war</packaging>
<parent>
<groupId>openwebinar.marvel.app</groupId>
<artifactId>app</artifactId>
<version>0.1.0-SNAPSHOT</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
My project structure, in this case I am running the mvn clean install command in the operwebinar_mavel folder:
What is in the maven route:
C: \ Users \ E10697 \ .m2 \ repository \ com \ oracle \ ojdbc7 \ 12.1.0
Add the Repository to your POM and it will work:
<repositories>
<repository>
<id>hand-china-repo</id>
<name>HandChinaRepo</name>
<url>http://nexus.saas.hand-china.com/content/repositories/rdc/</url>
</repository>
</repositories>
The repo is listed on the Maven Repository page:
https://mvnrepository.com/artifact/com.oracle/ojdbc7/12.1.0.2
Maven Central is reporting a similar dependency at version 12.1.0.2. Try changing your POM to match:
<!-- https://mvnrepository.com/artifact/com.oracle/ojdbc7 -->
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2</version>
</dependency>
I tested and this combination of adding the repo and the exact version works for me.

Junit test cases are not running when i do mvn clean install

I have written a spring boot application. I have written Junit test cases as well for that. When i run mvn clean install command, test cases are not running as part of that mvn build. But when i just right click and run as Junit test case all my test cases execute. I believe there is some configuration error.
Am using spring-boot, maven as build and Eclipse ide.
My test class name is TestService.java and it is in src/test folder
public class TestService {
JsonUtil jsonUtil;
String jsonString;
#Before
public void setData() {
jsonString = "{\"id\":\"one\"}";
jsonUtil = new JsonUtil(new ObjectMapper());
}
#Test
public void testGetStringAsJson() {
JsonNode node = jsonUtil.getStringAsJson(jsonString);
Assert.assertEquals("one", node.get("id").textValue());
}
}
Below is 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.xyz</groupId>
<artifactId>xyz</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>xyz</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<!-- dependency versions -->
<com.google.guava.guava.version>22.0</com.google.guava.guava.version>
<io.springfox.springfox-swagger2>2.7.0</io.springfox.springfox-swagger2>
<io.springfox.springfox-swagger-ui>2.7.0</io.springfox.springfox-swagger-ui>
</properties>
<dependencies>
<!-- For default Spring Boot utilities -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- For testing possibility -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- For all mvc and web functions -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
<!-- Spring security related dependencies
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>-->
<!-- Default persistence functions -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-java8</artifactId>
<version>5.0.5.Final</version>
</dependency>
<!-- In-Memory DB -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<!-- Java Utilities from google -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${com.google.guava.guava.version}</version>
</dependency>
<!-- Include swagger for API description -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${io.springfox.springfox-swagger2}</version>
</dependency>
<!-- Include swagger for API description UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${io.springfox.springfox-swagger-ui}</version>
</dependency>
<!-- Common libraries -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Maven output
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building xyz 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) # xyz ---
[INFO] Deleting C:\Users\rk\Documents\WS\xyz\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # xyz ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # xyz ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 17 source files to C:\Users\rk\Documents\WS\xyz\target\classes
[WARNING] /C:/Users/rk/Documents/WS/xyz/src/main/java/com/weather/xyzTestApplication.java: C:\Users\rk\Documents\WS\xyz\src\main\java\com\weather\xyzTestApplication.java uses or overrides a deprecated API.
[WARNING] /C:/Users/rk/Documents/WS/xyz/src/main/java/com/weather/xyzTestApplication.java: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # xyz ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # xyz ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to C:\Users\rk\Documents\WS\xyz\target\test-classes
[WARNING] /C:/Users/rk/Documents/WS/xyz/src/test/java/com/weather/controller/TestxyzController.java: C:\Users\rk\Documents\WS\xyz\src\test\java\com\weather\controller\TestxyzController.java uses unchecked or unsafe operations.
[WARNING] /C:/Users/rk/Documents/WS/xyz/src/test/java/com/weather/controller/TestxyzController.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) # xyz ---
[INFO]
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) # xyz ---
[INFO] Building jar: C:\Users\rk\Documents\WS\xyz\target\xyz-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.4.RELEASE:repackage (default) # xyz ---
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) # xyz ---
[INFO] Installing C:\Users\rk\Documents\WS\xyz\target\xyz-0.0.1-SNAPSHOT.jar to C:\Users\rk\.m2\repository\com\weather\xyz\0.0.1-SNAPSHOT\xyz-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\Users\rk\Documents\WS\xyz\pom.xml to C:\Users\rk\.m2\repository\com\weather\xyz\0.0.1-SNAPSHOT\xyz-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.643 s
[INFO] Finished at: 2018-09-24T22:44:24+05:30
[INFO] Final Memory: 34M/248M
[INFO] ------------------------------------------------------------------------
Check pom.xml go to 'Effective POM' view.
Check the value for tag under . It seems like it is not pointing to the proper location. You may override the property in pom.xml if it is pointing to a different location.
How would you have created the pom through spring initializer or manually? Most likely build path issue causing plugin not to execute. Can you check which version is being used once run through eclipse later verify through mvn dependency: tree just to know the same version is also available from cmd.

Spring Boot application build with Maven encounters Java Version Issue

I was trying to build an application using maven build.It was returning this build failure even though I have placed my pom.xml file is in-place.
I have configure my pom with out any issue.But I can see that there is some error returning related to schema.But don't have much information on that
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.amazon:amazon:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.springframework.boot:spring-boot-starter-test:jar -> duplicate declaration of version (?) # line 65, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building MyApplication 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) # amazon ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) # amazon ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to /Users/Arun/Documents/SpringBoot/MyApplication/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.051 s
[INFO] Finished at: 2018-06-09T08:00:55-07:00
[INFO] Final Memory: 25M/220M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "pom.xml" could not be activated because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project amazon: Fatal error compiling: invalid target release: 1.8.0_73 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Below is the pom.xml which I am using as of now.
<?xml version="1.0" encoding="UTF-8"?>
<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.amazon</groupId>
<artifactId>amazon</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MyApplication</name>
<description>Demo project</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.2.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8.0_73</java.version>
<start-class>com.amazon.service.MyApplication</start-class>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jersey</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-hal-browser</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.tomcat.embed/tomcat-embed-jasper -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-test</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.restdocs</groupId>
<artifactId>spring-restdocs-mockmvc</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-data-jpa -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
According to your logs:
Fatal error compiling: invalid target release: 1.8.0_73
You might be using an inferior JDK version (1.7 for example) to compile your project to a higher target version (1.8.0_73 in your case).
Try installing JDK 1.8 and make your JAVA_HOME environment variable point to it.
Generally you should make sure the source JDK and target JDK are matching between your pom.xml file and your JAVA_HOME environment variable.
You can try maven compiler plugin
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
Remove the duplicate dependency added
<artifactId>spring-boot-starter-test</artifactId>
And
Try pointing to JDK 1.8 in project build path and make your JAVA_HOME environment to this
In general the minor release number (for java) is not configured in pom.xml. Only major release number will be require.
Try to change 1.8.0_73 to 1.8.
To understand the java version system please visit this link.
Looking in your maven output, it is clear that you have a duplicate dependency declaration. Moreover, it is clear that the duplicate dependency is the org.springframework.boot:spring-boot-starter-test.
What is the process of solving the issue and removing this WARNING:
Look VERY carefully your pom.xml. You probably have declared the dependency twice.
An other cause of this warning might be that a dependency is declared twice, but with different versions. The solution, again, is to delete the dependency for one of them.
Command mvn dependency:tree -Dverbose might be useful.
Finally, after writing the above process, I looked in the pom.xml file you posted in your question and found that you have declared the following dependency twice (line:54 and line:65).
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
As far as I am concerned, this library is used for testing purposes only. If this is true, depending on your requirements, you should keep only the dependency in line 54 and the warning will be removed.

Maven Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile

I got this Stacktrace. I have JDK 1.8. The POMs are after the Stacktrace.
$ mvn clean install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building mt_product 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # mt_product ---
[INFO] Deleting F:\Drive\Workspace\mt_product\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # mt_product ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) # mt_product ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 3 source files to F:\Drive\Workspace\mt_product\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.838 s
[INFO] Finished at: 2015-12-16T09:54:25+01:00
[INFO] Final Memory: 7M/18M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project mt_product: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Parent POM
mvn clean install on this project is no Problem
<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>de.meinTellerchen</groupId>
<artifactId>mt_parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>mt_parent</name>
<description>Has dependencies for all Projects</description>
<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>com.fasterxml</groupId>
<artifactId>jackson-xml-databind</artifactId>
<version>0.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.0-beta1</version>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.proxytoys</groupId>
<artifactId>proxytoys</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.mongodb.morphia</groupId>
<artifactId>morphia</artifactId>
<version>1.0.0-rc0</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>
Example for a POM in a project that was failed
<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>
<parent>
<groupId>de.meinTellerchen</groupId>
<artifactId>mt_parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<groupId>de.meinTellerchen</groupId>
<artifactId>mt_product-srv</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>mt_product-srv</name>
<dependencies>
<dependency>
<groupId>de.meinTellerchen</groupId>
<artifactId>mt_product</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.meinTellerchen</groupId>
<artifactId>mt_utils</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.meinTellerchen</groupId>
<artifactId>mt_intolerance</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>de.meinTellerchen</groupId>
<artifactId>mt_product</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
$ mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00)
Maven home: C:\maven
Java version: 1.8.0_66, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jre1.8.0_66
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "x86", family: "dos"
Of curse I use the Update command.
Thank you for help. I don't find an answere in the other posts.

Categories

Resources