I have three maven project one is pom package and other 2 are jar packaging here is the admin-aggreagator pom
<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.sounds.bvs</groupId>
<artifactId>admin-aggregator</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>../admin-lib</module>
<module>../admin-rest</module>
</modules>
<properties>
<project.build.SourceEncoding>UTF-8</project.build.SourceEncoding>
<spring-boot-version>2.0.4.RELEASE</spring-boot-version>
<spring-version>2.0.4.RELEASE</spring-version>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<start-class>com.sounds.bvs.AdminRestApp</start-class>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.4.RELEASE</version>
</parent>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.sounds.bvs</groupId>
<artifactId>admin-lib</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.sounds.bvs</groupId>
<artifactId>admin-rest</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>exec</classifier>
<mainClass>${start-class}</mainClass>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven.compiler.plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showDeprication>true</showDeprication>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
And the admin-rest pom.xml and its Main class i'm not getting as what i'm missing as the ctrl-click is navigating to respective project and type search is able to find the main class in admin-rest project ctrl+shift+T is also getting still it is showing same,
<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>com.sounds.bvs</groupId>
<artifactId>admin-aggregator</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>admin-rest</artifactId>
<dependencies>
<dependency>
<groupId>com.sounds.bvs</groupId>
<artifactId>admin-lib</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-jetty -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
</dependencies>
</project>
The Main Class AdminRestApp.java and i'm trying to run the admin-aggregator with
mvn clean spring-boot:run
mvnw.cmd clean spring-boot:run
./mvnw spring-boot:run
but none are working
package com.sounds.bvs;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class AdminRestApp {
public static void main(String[] args) {
SpringApplication.run(AdminRestApp.class, args);
}
}
and the exception i see class not found exception i tried all which were from similar topic none helped, the start-class tag is also place and hard code the full path com.sounds.bvs.AdminRestApp in mainClass still that also did not help,
i have tried changing spring boot version as well as maven compiler plugin version that also dint helped please help is need very badly.
earlier the package path was large com.sounds.bvs.admin.rest that time also same issue changed the package name also dint helped
please let me know what i'm missing thanks in advance.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] `enter code here`
[INFO] admin-aggregator
[INFO] admin-lib
[INFO] admin-rest
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building admin-aggregator 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) # admin-aggregator ---
[INFO]
[INFO] >>> spring-boot-maven-plugin:2.0.4.RELEASE:run (default-cli) > test-compile # admin-aggregator >>>
[INFO]
[INFO] <<< spring-boot-maven-plugin:2.0.4.RELEASE:run (default-cli) < test-compile # admin-aggregator <<<
[INFO]
[INFO] --- spring-boot-maven-plugin:2.0.4.RELEASE:run (default-cli) # admin-aggregator ---
[WARNING]
java.lang.ClassNotFoundException: com.sounds.bvs.AdminRestApp
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:491)
at java.lang.Thread.run(Thread.java:745)
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] admin-aggregator ................................... FAILURE [ 42.358 s]
[INFO] admin-lib .......................................... SKIPPED
[INFO] admin-rest ......................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 56.280 s
[INFO] Finished at: 2018-08-10T00:43:37+05:30
[INFO] Final Memory: 17M/111M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.4.RELEASE:run (default-cli) on project admin-aggregator: An exception occurred while running. com.sounds.bvs.AdminRestApp -> [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
Adding a spring boot version solved my problem.
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.1</version>
</plugin>
</plugins>
replace with your version of spring boot in Maven Tab ->plugins
it worked for me.
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
</build>
Adding ${project.parent.version} to the dependency in pom.xml solved the problem for me.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${project.parent.version}</version>
<type>maven-plugin</type>
</dependency>
Only add the version.
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${project.parent.version}</version>
Exception Error
I read here https://docs.spring.io/spring-android/docs/2.0.0.M3/reference/html/maven.html.
And followed the link: https://search.maven.org/ - typed in the search: spring-boot-maven-plugin..
And get my dependency.
And it worked for me.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.4.RELEASE</version>
<type>maven-plugin</type>
</dependency>
You have to execute the mvn spring-boot:run command from the module maven that contains the Spring Boot application (admin-rest), not from the parent module (admin-aggregator).
But you execute it from the parent module.
I deleted .m2 folder and reinstall pom.xml file and the problem was solved.
You need to add the Spring Boot version like so:
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>version</version>
Related
As title, I deploy the package to jcenter successly,this is my 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>
<groupId>io.github.bloodnighttw.JDAwP</groupId>
<artifactId>JDAwP</artifactId>
<version>1.0.0_6</version>
<packaging>jar</packaging>
<name>JDAwP</name>
<distributionManagement>
<repository>
<id>bintray-bloodnighttw-JDAwP</id>
<name>bloodnighttw-JDAwP</name>
<url>https://api.bintray.com/maven/bloodnighttw/JDAwP/JDAwP/;publish=1</url>
</repository>
</distributionManagement>
<repositories>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>4.1.1_104</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName></shadedClassifierName> <!-- Any name that makes sense -->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
So i run mvn deploy ,it deploy successly.(this is my source code)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:00 min
[INFO] Finished at: 2020-02-11T18:56:26+08:00
[INFO] ------------------------------------------------------------------------
And i want to use this package in another project.
So i add something into my another project's pom.xml.
This is my "Another Project's" 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>io.github.bloodnighttw</groupId>
<artifactId>Another-Projects</artifactId>
<version>0.0-SNAPSHOT</version>
<repositories>
<repository>
<id>jcenter</id>
<name>jcenter-bintray</name>
<url>https://jcenter.bintray.com</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.github.bloodnighttw.JDAwP</groupId>
<artifactId>JDAwP</artifactId>
<version>1.0.0_5</version>
<type>pom</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
There is only a class in my projects(locate in /src/main/java/)
It is "Main.java", And the code of this file is that:
import io.github.*;
public class Main{
//nothing here
}
And I run mvn install , I got this error!
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.212 s
[INFO] Finished at: 2020-02-11T18:49:06+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project Another-Projects: Compilation failure
[ERROR] /home/bbeenn1227/桌面/testMaven/src/main/java/Main.java:[1,1] package io.github does not exist
(By the way,I pretty sure that i have package "io.github.*")
I keep google a solution in this week,but I can't find any answer how to solve it.
So I decided to post a question on stackoverflow.
If you think my question is so stupid,just give me a little information about how to deal with it.
(And sorry about my bad english)
The dependency should probably be
<dependency>
<groupId>io.github.bloodnighttw.JDAwP</groupId>
<artifactId>JDAwP</artifactId>
<version>1.0.0_5</version>
</dependency>
instead of
<dependency>
<groupId>io.github.bloodnighttw.JDAwP</groupId>
<artifactId>JDAwP</artifactId>
<version>1.0.0_5</version>
<type>pom</type>
</dependency>
I have a maven multimodule project composed of 7 projects
Parent Pom
<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>dag-app.dag</groupId>
<artifactId>dag-app</artifactId>
<version>3.0.0.RELEASE</version>
<packaging>pom</packaging>
<name>dag Parent application (pom)</name>
<description>dag parent pom application</description>
<properties>
<maven.resources.overwrite>true</maven.resources.overwrite>
<project.build.sourceEncdagng>UTF-8</project.build.sourceEncdagng>
<!-- temporarly disable tests -->
<maven.test.skip>true</maven.test.skip>
<argLine>-noverify</argLine>
<!-- other dependencies -->
</properties>
<dependencyManagement>
<dependencies>
<!-- business project dependency -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dag-business</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- db repository project dependency -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dag-db-repository</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- db model project dependency -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dag-db-model</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- es repository dependency -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dag-es-repository</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- es model dependency -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dag-es-model</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- common dependency -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dag-common</artifactId>
<version>${project.parent.version}</version>
</dependency>
<!-- other dependencies -->
</dependencyManagement>
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<pluginManagement>
<plugins>
<!-- compiler plugin -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<modules>
<module>../dag-common</module>
<module>../dag-es-model</module>
<module>../dag-db-model</module>
<module>../dag-es-repository</module>
<module>../dag-db-repository</module>
<module>../dag-business</module>
<module>../dag-rest</module>
</modules>
<!-- private application repository -->
<repositories>
<repository>
<id>privateRepo</id>
<name>privateRepo</name>
<releases>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://rnexus.intra.dag.fr/rnexus/content/repositories/dag-projects/</url>
</repository>
<!-- local repo -->
<repository>
<id>localrepository</id>
<url>file://D:/Public/Dev/Repo/</url>
<snapshots>
<enabled>true</enabled>
<checksumPolicy>fail</checksumPolicy>
</snapshots>
</repository>
</repositories>
</project>
The application compiles and build properly locally and using Jenkins
[INFO] Reactor Summary:
[INFO]
[INFO] dag Parent application (pom) ....................... SUCCESS [ 2.657 s]
[INFO] dag-common ......................................... SUCCESS [ 8.635 s]
[INFO] dag-es-model ....................................... SUCCESS [ 1.871 s]
[INFO] dag-db-model ....................................... SUCCESS [ 0.883 s]
[INFO] dag-es-repository .................................. SUCCESS [ 9.465 s]
[INFO] dag-db-repository .................................. SUCCESS [ 12.457 s]
[INFO] dag-business ....................................... SUCCESS [ 6.288 s]
[INFO] dag-rest ........................................... SUCCESS [ 31.430 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:14 min
[INFO] Finished at: 2018-07-27T10:33:28+02:00
[INFO] Final Memory: 47M/116M
[INFO] ------------------------------------------------------------------------
But then after the build we have a liquibase(mvn liquibase:update) task which fails
Entering stage LiquiBase Migration
Proceeding
[Pipeline] node
Running on Agent-s0066tts in /logiciel/work/f34668da/workspace/dag-65454/dag Performance
[Pipeline] {
[Pipeline] withCredentials
[Pipeline] {
[Pipeline] tool
[Pipeline] sh
[dag Performance] Running shell script
+ cd dag-db-repository
+ /logiciel/jenkins/apache-maven-3.3.9/bin/mvn liquibase:update
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building dag-db-repository 3.0.0.RELEASE
[INFO] ------------------------------------------------------------------------
Downloading: http://rnexus.intra.dag.fr/rnexus/content/groups/dag-entry/dag-app/dag/dag-db-model/3.0.0.RELEASE/dag-db-model-3.0.0.RELEASE.pom
Downloading: http://rnexus.intra.dag.fr/rnexus/content/repositories/releases/dag-app/dag/dag-db-model/3.0.0.RELEASE/dag-db-model-3.0.0.RELEASE.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.102 s
[INFO] Finished at: 2018-07-27T10:33:35+02:00
[INFO] Final Memory: 10M/60M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project dag-db-repository: Could not resolve dependencies for project dag-app.dag:dag-db-repository:jar:3.0.0.RELEASE: Could not find artifact dag-app.dag:dag-db-model:jar:3.0.0.RELEASE in dagMirror (http://rnexus.intra.dag.fr/rnexus/content/groups/dag-entry/) -> [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
There is the pom of the db-repository which have db-model as a dependency
<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 -->
<parent>
<groupId>dag-app.dag</groupId>
<artifactId>dag-app</artifactId>
<version>3.0.0.RELEASE</version>
<relativePath>../dag-app</relativePath>
</parent>
<!-- current module -->
<name>dag-db-repository</name>
<description>database layer of the application(data-access-object)</description>
<artifactId>dag-db-repository</artifactId>
<packaging>jar</packaging>
<dependencies>
<!-- db model dependency -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>dag-db-model</artifactId>
</dependency>
<!-- other dependencies -->
</dependencies>
<!-- build plugin -->
<build>
<!-- compiler plugin inherited from parent -->
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArguments>
<processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
</compilerArguments>
</configuration>
</plugin>
<!-- liquibase migration DB plugin -->
<!-- problem is here -->
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.0.5</version>
<configuration>
<propertyFile>src/main/resources/liquibase/liquibase.properties</propertyFile>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
</configuration>
<executions>
<execution>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
As you can see it fails when executing liquibase-maven-plugin
I don't understand why maven try to rebuild the project when executing this plugin because it's juste a database scripts update
It fails because it try to build a single module so obviously it cannot find the dag-db-model module and try to download it from remote
I can reproduce this error locally by removing dab-db-model from my local repo and doing a mvn clean install or mvn liquibase:update on the dab-db-repository module
How can i avoid the rebuild of the dab-db-repository module when executing the liquibase task or at least do not redownload dependencies ( because the full build of the application was already OK)
Thank you very much
I am running the "hello world" canned project off of spring.io (https://spring.io/guides/gs/rest-service/).
I am using JDK7 and Maven 3.0.3. I have cleared my local maven repo entirely to start with a clean slate. The build fails consistently with the message:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-resources-plugin:2.6:resources
(default-resources) on project gs-rest-service: Execution
default-resources of goal
org.apache.maven.plugins:maven-resources-plugin:2.6:resources failed:
Unable to load the mojo 'resources' in the plugin
'org.apache.maven.plugins:maven-resources-plugin:2.6'. A required
class is missing: org/codehaus/plexus/util/Scanner
With "mvn -X clean install", I get a detailed report, excerpts from which are given below:
$ mvn -X clean install
//...
Downloaded:
https://repo.spring.io/libs-release/org/codehaus/plexus/plexus-interpolation/1.13/plexus-interpolation-1.13.jar
(60 KB at 116.9 KB/sec) Feb 08, 2015 2:26:54 PM
org.sonatype.guice.bean.reflect.NamedClass WARNING: Error injecting:
org.apache.maven.shared.filtering.DefaultMavenResourcesFiltering
java.lang.NoClassDefFoundError: org/codehaus/plexus/util/Scanner //...
Caused by: java.lang.ClassNotFoundException:
org.codehaus.plexus.util.Scanner
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
... 73 more
[INFO]
------------------------------------------------------------------------ [INFO] BUILD FAILURE //...
My pom.xml is as follows:
//... org.springframework
gs-rest-service
0.1.0
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.10.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build> <repositories>
<repository>
<id>plexus-releases</id>
<url> http://mirrors.ibiblio.org/pub/mirrors/maven2/
</url>
</repository>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>plexus-releases</id>
<url>http://search.maven.org/</url>
</pluginRepository>
<pluginRepository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</pluginRepository>
</pluginRepositories>
Any help greatly appreciated - I have tried cleaning the repo, adding the dependencies specifically for the plugin - all of no avail.
Thanx - Kobe
I am new to Maven and I have seen many similar posts as mine, but I could not get my problem resolved.
I have a Maven project which has Maven Dependencies on other Maven Projects.
However, while carrying out Maven Build on the project with the goal being 'package' I get the following trace.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building docsvcs 1
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for org.idiginfo.docsvc:models:jar:1 is missing, no dependency information available
[WARNING] The POM for org.idiginfo.docsvc:apisvc:jar:1 is missing, no dependency information available
[WARNING] The POM for org.idiginfo.docsvc:repositories:jar:1 is missing, no dependency information available
[WARNING] The POM for org.idiginfo.docsvc:views:jar:1 is missing, no dependency information available
[WARNING] The POM for org.idiginfo.docsvc:wok_v3:jar:1 is missing, no dependency information available
[WARNING] The POM for org.idiginfo.docsvc:harvest:jar:1 is missing, no dependency information available
[WARNING] The POM for org.idiginfo.docsvc:controllers:jar:1 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.270s
[INFO] Finished at: Mon Mar 03 14:23:34 EST 2014
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project docsvcs: Could not resolve dependencies for project org.idiginfo.docsvc:docsvcs:war:1: The following artifacts could not be resolved: org.idiginfo.docsvc:models:jar:1, org.idiginfo.docsvc:apisvc:jar:1, org.idiginfo.docsvc:repositories:jar:1, org.idiginfo.docsvc:views:jar:1, org.idiginfo.docsvc:wok_v3:jar:1, org.idiginfo.docsvc:harvest:jar:1, org.idiginfo.docsvc:controllers:jar:1: Failure to find org.idiginfo.docsvc:models:jar:1 in http://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [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.
I carried out the Maven clean followed by Maven Update Project.
Here 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>org.idiginfo.docsvc</groupId>
<artifactId>docsvcs</artifactId>
<packaging>war</packaging>
<parent>
<groupId>org.idiginfo.docservice</groupId>
<artifactId>service</artifactId>
<version>1</version>
<relativePath>../service</relativePath>
</parent>
<build>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<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>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warName>docsvcs</warName>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
<dependentWarExcludes>WEB-INF/web.xml,**/**.class</dependentWarExcludes>
<webResources>
<resource>
<!-- change if necessary -->
<directory>src/main/webapp/WEB-INF</directory>
<filtering>true</filtering>
<targetPath>WEB-INF</targetPath>
</resource>
<resource>
<directory>../repositories/src/META-INF</directory>
<!-- override the destination directory for this resource -->
<targetPath>WEB-INF/classes/META-INF</targetPath>
<includes>
<include>persistence.xml</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.idiginfo.docsvc</groupId>
<artifactId>models</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.idiginfo.docsvc</groupId>
<artifactId>apisvc</artifactId>
<version>1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.idiginfo.docsvc</groupId>
<artifactId>repositories</artifactId>
<version>1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.idiginfo.docsvc</groupId>
<artifactId>views</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.idiginfo.docsvc</groupId>
<artifactId>wok_v3</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.idiginfo.docsvc</groupId>
<artifactId>harvest</artifactId>
<version>1</version>
</dependency>
<dependency>
<groupId>org.idiginfo.docsvc</groupId>
<artifactId>controllers</artifactId>
<version>1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
</repository>
</repositories>
</project>
I'm trying to create custom checkstyle. Already have SNAPSHOT on sonatype however the test project where I'm trying to test it on is not able to pull depencency. Error is
[INFO] Building TestProject 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-checkstyle-plugin:2.10:checkstyle (default-cli) # TestProject ---
Downloading: http://repository.apache.org/snapshots/com/novoda/novoda-checkstyle-checks/1.0-SNAPSHOT/maven-metadata.xml
Downloading: http://repository.apache.org/snapshots/com/novoda/novoda-checkstyle-checks/1.0-SNAPSHOT/novoda-checkstyle-checks-1.0-SNAPSHOT.pom
[WARNING] The POM for com.novoda:novoda-checkstyle-checks:jar:1.0-SNAPSHOT is missing, no dependency information available
Downloading: http://repository.apache.org/snapshots/com/novoda/novoda-checkstyle-checks/1.0-SNAPSHOT/novoda-checkstyle-checks-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.993s
[INFO] Finished at: Thu Aug 08 16:37:42 BST 2013
[INFO] Final Memory: 6M/81M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.10:checkstyle (default-cli) on project TestProject: Execution default-cli of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.10:checkstyle failed: Plugin org.apache.maven.plugins:maven-checkstyle-plugin:2.10 or one of its dependencies could not be resolved: Could not find artifact com.novoda:novoda-checkstyle-checks:jar:1.0-SNAPSHOT in apache.snapshots (http://repository.apache.org/snapshots) -> [Help 1]
Here is project pom
<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>TestProject</groupId>
<artifactId>TestProject</artifactId>
<version>0.0.1</version>
<properties>
<checkstyle.config.location>properties/checkstyle-configuration.xml</checkstyle.config.location>
</properties>
<repositories>
<repository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<dependencies>
<dependency>
<groupId>com.novoda</groupId>
<artifactId>novoda-checkstyle-checks</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Any idea why dependency plugin is not downloaded?
Solution is simple. Since it is plugin that I'm trying to fetch I need to use pluginRepositories instead of repositories
<pluginRepositories>
<pluginRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
You can see that maven is looking for the snapshot in the wrong repo http://repository.apache.org/snapshots/
Your artifact is in https://oss.sonatype.org/content/repositories/snapshots
Either the pom you are using to run is not the one that defines the sonatype <repository> or it is being overwriten. Check the effective pom in the folder where you run maven and find the definition, you will probably find it is apache.org and not sonatype's
Alternatively, it is usually not recommended to use <repository> in your poms since it makes the artifacts unusable by others that don't have access to the special repo, check this article. I prefer configuring the custom repo (sonatype snapshots) in settings.xml