Maven fails with classpath errors and recover when a new project is opened - maven

I have the following pom.xml file:
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<start-class>com.example.Main</start-class>
</properties>
<groupId>SpringProject</groupId>
<artifactId>SpringProject</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<mainClass>com.phoneBook.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.10.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>1.2.2.RELEASE</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
As you can understand, it's a spring-boot application. When I run it, I get the error:
Elasticsearch “StatusLogger Log4j2 could not find a logging
implementation. Please add log4j-core to the classpath.”
and log4j2 doesn't act properly.
However, the solution that I found is to open a new project, copy all files, and then surprisingly everything works perfectly and this error doesn't show.
Yesterday, I had another problem that I also got an error for something with classpath and again opening a new Project and copying files solved it.
Do you know what can cause such errors and whether there is a more comfortable way to resolve it without opening a new project and copy files?

Related

Spring boot 2.3.5 migration problems - only in my local environment

We migrated from the 2.3.4 to 2.3.5 spring boot version. Everything works fine except when I run the project on my own machine. I could run the project with the 2.3.4 version but it couldn't resolve beans dependences with the 2.3.5 version. If I run my own project in another environment it works fine.
Local configuration:
Java SE 11.0.10
Apache Maven 3.8.1
mac os x", version: "10.15.7", arch: "x86_64", family: "mac"
Any idea what's going on?
I reinstalled all.
Error: Unsatisfied dependency expressed through constructor parameter 3; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘XXXXX’ defined in file [XXXX.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘XX’ defined in class path resource.
The pom file is the same in each case.
<?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>XXXX</artifactId>
<name>XXXX</name>
<version>1.0-SNAPSHOT</version>
<groupId>XXXXX</groupId>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.5.RELEASE</version>
</parent>
<properties>
<java.version>11</java.version>
<spring-boot.version>2.3.5.RELEASE</spring-boot.version>
<maven-pmd-plugin.version>3.13.0</maven-pmd-plugin.version>
<maven-checkstyle-plugin.version>3.1.0</maven-checkstyle-plugin.version>
<io.springfox.version>2.9.2</io.springfox.version>
<jacoco-maven.version>0.8.5</jacoco-maven.version>
<swagger-annotations.version>2.1.2</swagger-annotations.version>
<springdoc-openapi-ui.version>1.4.3</springdoc-openapi-ui.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>${spring-boot.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<!-- OPENAPI 3.0 libs -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>${springdoc-openapi-ui.version}</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger-annotations.version}</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco-maven.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-pmd-plugin.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<executions>
<execution>
<id>validate</id>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${maven-pmd-plugin.version}</version>
<executions>
<execution>
<id>validate</id>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-property</id>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>maven-group</id>
<url>https://XXXXX</url>
</repository>
</repositories>
Thanks.
Regards

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.1.3.RELEASE:run (default-cli)

I try to run a Spring Boot application, the application is run with maven spring-boot:run, but still I have a problem, I'm new to java spring boot, I can't fix this problem, how to fix this problem and thank's, here is the problem :
Failed to execute goal
org.springframework.boot:spring-boot-maven-plugin:2.1.3.RELEASE:run
(default-cli) on project app-back: An exception occurred while
running. null
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>
<artifactId>app-back</artifactId>
<name>app-back</name>
<description>module app backend </description>
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
</parent>
<properties>
<start-class>AppApplication</start-class>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<hibernate.core.version>5.4.2.Final</hibernate.core.version>
<maven.war.plugin.version>3.2.0</maven.war.plugin.version>
<jjwt.version>0.9.1</jjwt.version>
</properties>
<dependencies>
<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>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.core.version}</version>
</dependency>
<!-- Spring data JPA, default tomcat pool, exclude it -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/io.jsonwebtoken/jjwt -->
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>${jjwt.version}</version>
</dependency>
</dependencies>
<build>
<finalName>app</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.plugin.version}</version>
<configuration>
<packagingExcludes>WEB-INF/lib/tomcat-*.jar</packagingExcludes>
<warName>app</warName>
</configuration>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>validate</phase>
<goals><goal>copy-resources</goal></goals>
<configuration>
<outputDirectory>${basedir}/target/classes/static/</outputDirectory >
<resources>
<resource>
<directory>../app-front/dist/app-front</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Assuming you already have the dependency for embedded Tomcat server and you want to run it the way you want to, you will have to add your main class name in the spring boot maven plugin like below.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>fully qualified Main Class name</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>

How to copy only OS specific dependency jars by Maven?

I'm currently working on a project that uses (among others) nd4j, deeplearning4j dependencies. These dependencies include versions for different OS, like "nd4j-native-1.0.0-beta6-android-arm.jar" or "nd4j-native-1.0.0-beta6-linux-armhf.jar" etc.
As the project will only run on linux-x64, I'm wondering whether there's a way to tell Maven to not copy the JARs that are not needed. I hope to reduce the required disk space needed by unnecessary libs.
The pom.xml currently looks like this to be able to produce a deployable output:
<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>MyGroup</groupId>
<artifactId>MyApp</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.clerezza.ext</groupId>
<artifactId>org.json.simple</artifactId>
<version>0.4</version>
</dependency>
<dependency>
<groupId>com.kohlschutter.junixsocket</groupId>
<artifactId>junixsocket-core</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.kohlschutter.junixsocket</groupId>
<artifactId>junixsocket-server</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native-platform</artifactId>
<version>1.0.0-beta6</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-core</artifactId>
<version>1.0.0-beta6</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-parallel-wrapper</artifactId>
<version>1.0.0-beta6</version>
</dependency>
</dependencies>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/libs</outputDirectory>
<useRepositoryLayout>true</useRepositoryLayout>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathLayoutType>repository</classpathLayoutType>
<classpathPrefix>libs/</classpathPrefix>
<mainClass>MyMainClass</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Generally if you want to bundle platform specific binaries for dl4j or anything based on javacpp, you can do the following:
https://github.com/bytedeco/javacpp-presets/wiki/Reducing-the-Number-of-Dependencies
Concretely, you would just specify -Djavacpp.platform=linux-x86_64 for all javacpp dependencies.
You can set <exclusions> on dependencies:
https://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html
An example would be:
<dependency>
<groupId>com.something</groupId>
<artifactId>some-jar</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>de.dumm</groupId>
<artifactId>nicht-benutzen</artifactId>
</exclusion>
</exclusions>
</dependency>

Maven try to download a <packaing>pom</package> pom as a jar file and cannot find it

my maven pom.xml is quite simple:
<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.acb</groupId>
<artifactId>adfafa</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<!-- https://mvnrepository.com/artifact/org.pentaho/pentaho-aggdesigner -->
<groupId>org.pentaho</groupId>
<artifactId>pentaho-aggdesigner</artifactId>
<version>5.1.5-jhyde</version>
</dependency>
</dependencies>
</project>
From the pom.xml ,I just want pentaho-aggdesigner which is a parent pom of two modules pentaho-aggdesigner-core.jar and pentaho-aggdesigner-algorithm.jar , my remote repo is :http://repo.spring.io/plugins-release
so , I think ,maven will visit http://repo.spring.io/plugins-release/org/pentaho/pentaho-aggdesigner/5.1.5-jhyde/pentaho-aggdesigner-5.1.5-jhyde.pom to download the parent pom ,then , according to the pom, it will download two sub modules pentaho-aggdesigner-core.jar and pentaho-aggdesigner-algorithm.jar. The content of pentaho-aggdesigner-5.1.5-jhyde.pom is:
<?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>org.pentaho</groupId>
<artifactId>pentaho-aggdesigner</artifactId>
<packaging>pom</packaging>
<version>5.1.5-jhyde</version>
<name>Pentaho Aggregate Designer</name>
<description>Designs aggregate tables for the Mondrian OLAP engine</description>
<url>http://github.com/pentaho/mondrian</url>
<inceptionYear>2006</inceptionYear>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<distributionManagement>
<repository>
<id>conjars</id>
<name>Conjars</name>
<url>http://conjars.org/repo</url>
<layout>default</layout>
</repository>
</distributionManagement>
<issueManagement />
<scm>
<connection>scm:git:git://github.com/julianhyde/pentaho-aggdesigner.git</connection>
<developerConnection>scm:git:git#github.com:julianhyde/pentaho-aggdesigner.git</developerConnection>
<url>http://github.com/julianhyde/pentaho-aggdesigner/tree/master</url>
<tag>pentaho-aggdesigner-5.1.5-jhyde</tag>
</scm>
<modules>
<module>pentaho-aggdesigner-algorithm</module>
<module>pentaho-aggdesigner-core</module>
</modules>
<dependencyManagement>
<!-- Dependency versions for all sub-modules.
Sorted by groupId, artifactId. -->
<dependencies>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>org.pentaho</groupId>
<artifactId>pentaho-aggdesigner-algorithm</artifactId>
<version>5.1.5-jhyde</version>
</dependency>
<dependency>
<groupId>pentaho</groupId>
<artifactId>mondrian</artifactId>
<version>3.6.9</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.1-beta-6</version>
</dependency>
<!-- Test dependencies. -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock-junit4</artifactId>
<version>2.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmock</groupId>
<artifactId>jmock-legacy</artifactId>
<version>2.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.pentaho</groupId>
<artifactId>pentaho-aggdesigner-algorithm</artifactId>
<version>5.1.5-jhyde</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.17</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>pentaho</groupId>
<artifactId>mondrian-data-foodmart-hsqldb</artifactId>
<version>0.2</version>
</dependency>
</dependencies>
</dependencyManagement>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
<links>
<link>http://docs.oracle.com/javase/7/docs/api/</link>
</links>
</configuration>
</plugin>
</plugins>
</reporting>
<build>
<defaultGoal>package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>properties</id>
<goals>
<goal>properties</goal>
</goals>
<phase>initialize</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar-no-fork</goal>
<goal>test-jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<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-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-2</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>build.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<!-- If we don't specify gitexe version, git doesn't
commit during release process. -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.9.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
</plugin>
</plugins>
</build>
</project>
you can see , pom indicates clearly that I am not a jar pom but a package pom. But maven still consider it to be a jar pom and tries to download the pentaho-aggdesigner.jar from remote repo, of course , the jar file does not exist and throw this error:
[ERROR] Failed to execute goal on project adfafa: Could not resolve dependencies for project org.acb:adfafa:jar:0.0.1-SNAPSHOT: Could not find artifact org.pentaho:pentaho-aggdesigner:jar:5.1.5-jhyde in springmaven (http://repo.spring.io/plugins-release/) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project adfafa:
Could not resolve dependencies for project org.acb:adfafa:jar:0.0.1-SNAPSHOT: Could not find artifact org.pentaho:pentaho-aggdesigner:jar:5.1.5-jhyde in springmaven (http://repo.spring.io/plugins-release/)
I had the same issue with pentaho-aggdesigner:pom:5.1.5-jhyde, this site solved my problem
https://www.programmersought.com/article/76106349302/
Basically, used aliyun as mirror in maven settings.xml. And for this case, do not use repo.spring.io as mirror as it requires login and will have an "Authentication" error.
Nah, maven doesn't work like that. See also How to use POMs as a dependency in Maven?
A parent is just a trick to combine configuration for it's child modules. It doesn't automatically introduce transitive dependencies.
So you need to specify the exact jar dependencies. Probably something like:
<dependency>
<groupId>org.pentaho</groupId>
<artifactId>pentaho-aggdesigner-algorithm</artifactId>
<version>5.1.5-jhyde</version>
</dependency>
<dependency>
<groupId>org.pentaho</groupId>
<artifactId>pentaho-aggdesigner-core</artifactId>
<version>5.1.5-jhyde</version>
</dependency>
There are pom's that you can use like this, by including type 'pom' in your dependency:
<dependency>
<groupId>xxx.yyy</groupId>
<artifactId>pentaho-all</artifactId>
<type>pom</type>
<version>XXXX</version>
</dependency>
In this case, pentaho-all would be a pom with a list of direct dependencies that you then would import as transitive dependencies. But the aggregator pom you found does not have direct dependencies, only modules and dependency management, so that one won't work.
adding following dependency to pom.xml will help
<!-- https://mvnrepository.com/artifact/org.pentaho/pentaho-aggdesigner-algorithm -->
<dependency>
<groupId>org.pentaho</groupId>
<artifactId>pentaho-aggdesigner-algorithm</artifactId>
<version>5.1.5-jhyde</version>
<scope>test</scope>
</dependency>
Just download the file from any available repo and store in the proper folder e.g.
~/.m2/repository/org/pentaho/pentaho-aggdesigner-algorithm/5.1.5-jhyde/pentaho-aggdesigner-algorithm-5.1.5-jhyde.jar

Maven+ReportNG+Jenkins+Command Line

I would like to know how can I run a test built with maven to generate the report and then convert the report to ReportNG format using the command line.
To after that insert the report on Jenkins using the plugin HTML Reporter from Jenkins.
I want to do this because I am getting error when I put the listeners on test.
I am using this to execute the test by Jenkins:
mvn test (after using "mvn clean install" on first time)
I try use mvn install but I am getting the same error
Thanks
EDIT: So I finally manage to fix my POM file, the problem has some plugins that aren't specified like velocity, reportng and guice. Anyway I will left here my POM fixed so it can help someone else =)
<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>selenium.simple</groupId>
<artifactId>selenium-simple</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>selenium-simple</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.7</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.24.1</version>
</dependency>
<dependency>
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>velocity</groupId>
<artifactId>velocity-dep</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>3.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<!-- specify UTF-8, ISO-8859-1 or any other file encoding -->
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<systemPropertyVariables>
<webdriver.ie.driver>src/main/resources/drivers/internetexplorer/iedriverserver_2.24.1_x64.exe</webdriver.ie.driver>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Based on the error message:
Some problems were encountered while building the effective model
forselenium.simple:selenium-simple:jar:0.0.1-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. # line 43,
column 12
You should pin the version for maven-surefire-plugin like the following:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
...
</plugin>
</plugins>
..
</build>
If don't do this as you you will use an old version (maven-surefire-plugin:2.10) which might be too old. I assume that after you put the version into your pom the problems with the listener will be gone.
BTW: Why not using up-to-date versions of maven-resources-plugin (2.6) and testng (6.8.7)..

Resources