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
Related
Using liquibase with maven spring boot project have generated the snapshot at one state of db later tried generating the difference between the snapshot and online db using mvn liquibase:diff.
liquibase.properties as follows.
changeLogFile=src/main/resources/bd.changeLog-base.xml
diffChangeLogFile=src/main/resources/bd.changeLog-base.xml
outputChangeLogFile=src/main/resources/liquibase-new-changeLog.xml
url=offline:mysql?snapshot=src/main/resources/snap_shot.json
driver=com.mysql.jdbc.Driver
referenceDriver=com.mysql.jdbc.Driver
referenceUrl=jdbc:mysql://localhost:3306/db_sample
referenceUsername=yyyy
referencePassword=xxxx
using the following maven-plugin dependency in 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<!--<version>2.4.2</version>-->
<version>2.2.2.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>Liquibaseapplicationexample</groupId>
<artifactId>Liquibaseapplicationexample</artifactId>
<version>0.0.1-SNAPSHOT</version>
<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>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
</dependencies>
<build>
<finalName>liquibase-demo</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.5.5</version>
<configuration>
<propertyFile>src/main/resources/liquibase/config/liquibase.properties</propertyFile>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
</configuration>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.2.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>2.2.2.RELEASE</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>development</id>
<properties>
<build.profile.id>development</build.profile.id>
</properties>
</profile>
</profiles>
</project>
I am getting following error.
[INFO] Scanning for projects...
[INFO]
[INFO] ------< Liquibaseapplicationexample:Liquibaseapplicationexample >-------
[INFO] Building Liquibaseapplicationexample 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- liquibase-maven-plugin:3.6.1:diff (default-cli) # Liquibaseapplicationexample ---
[INFO] ------------------------------------------------------------------------
[INFO] Parsing Liquibase Properties File
[INFO] File: src/main/resources/liquibase/config/liquibase.properties
[INFO] 'outputChangeLogFile' in properties file is not being used by this task.
[INFO] ------------------------------------------------------------------------
[INFO] Starting Liquibase at Mon, 05 Apr 2021 01:21:53 IST (version 3.5.5 built at 2018-04-11 09:05:04)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.778 s
[INFO] Finished at: 2021-04-05T01:21:53+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.liquibase:liquibase-maven-plugin:3.5.5:diff (default-cli) on project Liquibaseapplicationexample: Error setting up or running Li
quibase: liquibase.exception.UnexpectedLiquibaseException: Cannot parse snapshot offline:mysql?snapshot=src/main/resources/snap_shot.json: src/main/resources/snap_shot.j
son does not exist -> [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.
Please help in solving this issue!
For me this issue fixed by upgrading liquibase-maven-plugin from 3.5.5 version to 3.10.1.
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.10.1</version>
I am able to execute my selenium scripts locally in Eclipse as Maven Project.
I am unable to execute the scripts in Jenkins from Ubuntu.
I have successfully configured jenkins and Build is successful. But scripts are not getting executed.
I am using local workspace.
Can someone please help me to find a solution?
My pom.xml as follows:
<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>ExpertusONE_4.5</groupId>
<artifactId>ExpertusONE_4.5</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>ExpertusONE_4.5</name>
<description>ExpertusONE_4.5</description>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M3</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
<includes>
<include>CreateOrganization.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<java.version>1.8.0_222</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
My console Output in Jenkins as follows:
Console Output
Started by user unknown or anonymous
Running as SYSTEM
Building in workspace /home/nivedab/ExpertusONE_4.5
Parsing POMs
Established TCP socket on 38039
[ExpertusONE_4.5] $ /usr/lib/jvm/java-8-openjdk-amd64/bin/java -cp /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-agent-1.13.jar:/opt/maven/boot/plexus-classworlds-2.6.0.jar:/opt/maven/conf/logging jenkins.maven3.agent.Maven35Main /opt/maven /var/cache/jenkins/war/WEB-INF/lib/remoting-3.33.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven35-interceptor-1.13.jar /var/lib/jenkins/plugins/maven-plugin/WEB-INF/lib/maven3-interceptor-commons-1.13.jar 38039
<===[JENKINS REMOTING CAPACITY]===>channel started
Executing Maven: -B -f /home/nivedab/ExpertusONE_4.5/pom.xml process-test-classes
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< ExpertusONE_4.5:ExpertusONE_4.5 >-------------------
[INFO] Building ExpertusONE_4.5 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # ExpertusONE_4.5 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 218 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) # ExpertusONE_4.5 ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # ExpertusONE_4.5 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/nivedab/ExpertusONE_4.5/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) # ExpertusONE_4.5 ---
[INFO] No sources to compile
Notifying upstream projects of job completion
Join notifier requires a CauseAction
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.744 s
[INFO] Finished at: 2019-11-05T14:26:37+05:30
[INFO] ------------------------------------------------------------------------
Waiting for Jenkins to finish collecting data
[JENKINS] Archiving /home/nivedab/ExpertusONE_4.5/pom.xml to ExpertusONE_4.5/ExpertusONE_4.5/0.0.1-SNAPSHOT/ExpertusONE_4.5-0.0.1-SNAPSHOT.pom
channel stopped
Notifying upstream projects of job completion.
My Jenkins job configuration:
jenkins job configuration
I guess your problem is the plugins version.I am using two plugins maven-surefire-plugin & maven-compiler-plugin with mention version. When I am used other version it does not work for me. You can give a try
<?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>VRS_NEW</groupId>
<artifactId>Regression_New</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>vrsautomation</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<configuration>
<useSystemClassLoader>false</useSystemClassLoader>
<forkCount>1</forkCount>
<useFile>false</useFile>
<skipTests>false</skipTests>
<testFailureIgnore>true</testFailureIgnore>
<forkMode>once</forkMode>
<suiteXmlFiles>
<suiteXmlFile>testing.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
</dependencies>
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>
I'm using nar-maven-plugin with my spring boot project, everything goes well when developing but when i run maven package the project the compilation goes well until the final step where throws me the error:
[INFO]
[INFO] --- nar-maven-plugin:3.2.0:nar-test (default-nar-test) # customertracker ---
[INFO] Preparing Nar dependencies
[INFO] Unpacking 0 dependencies to /home/diego/Development/Web/Spring/CustomerTracker/target/test-nar
[INFO]
[INFO] --- nar-maven-plugin:3.2.0:nar-prepare-package (default-nar-prepare-package) # customertracker ---
[INFO]
[INFO] --- nar-maven-plugin:3.2.0:nar-package (default-nar-package) # customertracker ---
[INFO] Building zip: /home/diego/Development/Web/Spring/CustomerTracker/target/customertracker-0.0.1-SNAPSHOT-amd64-Linux-gpp-jni.nar
[INFO]
[INFO] --- maven-jar-plugin:2.5:jar (default-jar) # customertracker ---
[INFO] Building jar: /home/diego/Development/Web/Spring/CustomerTracker/target/customertracker-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:1.2.3.RELEASE:repackage (default) # customertracker ---
[INFO] Attaching archive: /home/diego/Development/Web/Spring/CustomerTracker/target/customer-tracker-app.nar, with classifier: null
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 26.190 s
[INFO] Finished at: 2015-05-20T09:41:16-05:00
[INFO] Final Memory: 32M/401M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.2.3.RELEASE:repackage (default) on project customertracker: Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.2.3.RELEASE:repackage failed: For artifact {com.housingelectronics:customertracker:0.0.1-SNAPSHOT:nar}: An attached artifact must have a different ID than its corresponding main artifact. -> [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/PluginExecutionException
so i try to change the fileName property in spring-boot-maven-plugin and in my nar-maven-plugin output property, but not works
here is my maven simplified:
<?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.housingelectronics</groupId>
<artifactId>customertracker</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>nar</packaging> <-- changing this to jar works but the applications does not find the .so library on runtime -->
<name>CustomerTracker</name>
<description>Customer Tracker</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>customertracker.CustomerTrackerApplication</start-class>
<java.version>1.7</java.version>
</properties>
<dependencies>
...
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>1.2.1.RELEASE</version>
</dependency>
</dependencies>
<configuration>
<finalName>customer-tracker-app</finalName>
</configuration>
</plugin>
<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<version>3.2.0</version>
<extensions>true</extensions>
<executions>
<execution>
<id>default-cli</id>
<configuration>
<output>customer-tracker-nar-generated</output>
<cpp>
<sourceDirectory>src/main/c++/udevLaserScannerDriverJNI/</sourceDirectory>
<includes>
<include>laserscannerlistener.cpp</include>
<include>utils.cpp</include>
<include>netlink/**/*.cc</include>
</includes>
</cpp>
<c>
<excludes>
<exclude>**/node_modules/**/*.c</exclude>
</excludes>
</c>
<java>
<include>true</include>
</java>
<javah>
<jniDirectory>src/main/c++/udevLaserScannerDriverJNI/</jniDirectory>
</javah>
<libraries>
<library>
<type>jni</type>
<narSystemPackage>customertracker.devices.udev</narSystemPackage>
</library>
</libraries>
</configuration>
<!-- <phase>generate-sources</phase> -->
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Thanks for any help.
i found the solution, what i do is to use classifier option instead of fileName in the spring-boot-maven-plugin and it works, this produces to me two nar files, one with the spring-boot application and the other with the .so library, now the problem is use them for run the application but this problem is independent of this thread.
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>