I quite stuck with something I think is basic, but Maven does not enable me to package my project twice without doing some cleaning.
I'm working on a java project with multi-dependencies (different modules developped by different people, usual stuff) and one of them uses java classes generated using JAXB.
I'm using maven to make all that work together (one pom per module and one pom parent to built the whole project, basic stuff I said).
When I package the modules using dedicated pom there is no trouble (even if I do several successive package without cleaning). When I package the whole project for the first time (or after a clean) there is no problem at all too (*.java generated from XSDs, *.class, tests executed, Jar generated properly).
But now, if I re-do the package command, then maven says that it cannot find the classes generated using JAXB (and, then there are compilation issues in other java classes due to symbols that cannot be found, logic).
I think that Maven kind of "forgot" that it generated java classes during previous package but I don't know how to make it remember. So, up to now, I'm obliged to make it generate those classes and delete them, again and again (and its quite long as the clean cleans every other modules that will then be built again...).
So, if anyone has any clue on what I'm missing/doing wrong, I would be glad as none of my search here and there were successful.
I hope that I was clear enough. If not, feel free to ask for further explanation.
Thank you
P.S. I forgot to tell you that I'm using Maven with command line
EDIT :
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>my.package.for.mysoft</groupId>
<artifactId>mysoft-parent</artifactId>
<packaging>pom</packaging>
<version>1.3.0-SNAPSHOT</version>
<name>Main parent for MySoft modules</name>
<properties>
<mysoft_version>1.3.0-SNAPSHOT</mysoft_version>
<main_other_soft_version>1.3.1</main_other_soft_version>
<!-- SCADAsoft packages -->
<scadasoft.version>6.2.4.4</scadasoft.version>
<!-- Hypervisor packages -->
<othersoft2.version>2.9.0_P03</othersoft2.version>
<othersoft1.version>1.8.0_P03</othersoft1.version>
<othersoft3.version>1.2.8</othersoft3.version>
<hv.quartz-tc.version>2.2.1</hv.quartz-tc.version>
<!-- TVS packages -->
<tvs.common.version>3.6.5.0001</tvs.common.version>
<!-- Loggers -->
<slf4j.version>1.7.2</slf4j.version>
<log4j.version>1.2.17</log4j.version>
</properties>
<modules>
<module>mysoft-bom</module>
<module>mysoft-jaxb</module>
<module>mysoft-common</module>
<module>My-project-that-uses-jaxb-generated-classes</module>
</modules>
<distributionManagement>
<snapshotRepository>
<id>soft-repo-releases</id>
<name>SOFT maven repository - SNAPSHOTS</name>
<url>http://url.of.the.server:123/nexus/content/repositories/mysoft_snapshots/</url>
</snapshotRepository>
<repository>
<id>soft-repo-releases</id>
<name>Soft maven repository - RELEASES</name>
<url>http://url.of.the.server:123/nexus/content/repositories/mysoft_releases/</url>
</repository>
</distributionManagement>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.terracotta.quartz</groupId>
<artifactId>quartz-terracotta</artifactId>
<version>${hv.quartz-tc.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<deployAtEnd>false</deployAtEnd>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<executions>
<execution>
<id>enforce-parent-version</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>project.parent.version</property>
<regex>1.3.0.SNAPSHOT</regex>
</requireProperty>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Pom of the module that generates java classes
<?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>mysoft-jaxb</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>my.package.for.mysoft</groupId>
<artifactId>mysoft-parent</artifactId>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<name>MySoft generated classes</name>
<description>Classes generated by JAXB</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<othersoft1.version>1.8.0</othersoft1.version>
<othersoft2.version>2.9.0</othersoft2.version>
<othersoft3.version>1.2.8</othersoft3.version>
<mysoft.data.model>${main_other_soft_version}</mysoft.data.model>
<mysoft.common>${main_other_soft_version}</mysoft.common>
<mysoft.core>${main_other_soft_version}</mysoft.core>
<skipTests>false</skipTests>
</properties>
<distributionManagement>
<snapshotRepository>
<id>soft-repo-releases</id>
<name>Soft maven repository - SNAPSHOTS</name>
<url>http://url.of.the.server:123/nexus/content/repositories/mysoft_snapshots/</url>
</snapshotRepository>
<repository>
<id>soft-repo-releases</id>
<name>Soft maven repository - RELEASES</name>
<url>http://url.of.the.server:123/nexus/content/repositories/mysoft_releases/</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<environmentVariables>
<PATH>${java.library.path};${my_api_dir}\Bin;${project.basedir}\..\module-with-cpp\target\nar\lib\x86-Windows-msvc\jni</PATH>
</environmentVariables>
<argLine>-Xmx1024m</argLine>
</configuration>
</plugin>
<!-- Maven Compiler plugin: Inherited from Parent -->
<!-- Maven Jar plugin: Inherited from Parent -->
<!-- Maven Check Style Plugin: Inherited from Parent -->
<!-- Maven Assembly Plugin Plugin: Inherited from Parent -->
<!-- Maven JavaDoc Plugin: Inherited from Parent -->
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
</plugin>
<!-- generation of java classes using JAXB -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<sources>
<source>${project.build.sourceDirectory}/../resources/xsd/config.xsd</source>
</sources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>system_configuration/**</exclude>
<exclude>mysoft.properties</exclude>
<exclude>connector_configuration.xml</exclude>
<exclude>log4j.xml</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Module that uses the one with JAXB generated java classes
<?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>My-project-that-uses-jaxb-generated-classes</artifactId>
<packaging>jar</packaging>
<parent>
<groupId>my.package.for.mysoft</groupId>
<artifactId>mysoft-parent</artifactId>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<name>My project module 1</name>
<description>Module that uses Jaxb generated classes</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<othersoft1.version>1.8.0</othersoft1.version>
<othersoft2.version>2.9.0</othersoft2.version>
<othersoft3.version>1.2.8</othersoft3.version>
<mysoft.data.model>${main_other_soft_version}</mysoft.data.model>
<mysoft.common>${main_other_soft_version}</mysoft.common>
<mysoft.core>${main_other_soft_version}</mysoft.core>
<skipTests>false</skipTests>
</properties>
<distributionManagement>
<snapshotRepository>
<id>soft-repo-releases</id>
<name>Soft maven repository - SNAPSHOTS</name>
<url>http://url.of.the.server:123/nexus/content/repositories/mysoft_snapshots/</url>
</snapshotRepository>
<repository>
<id>soft-repo-releases</id>
<name>Soft maven repository - RELEASES</name>
<url>http://url.of.the.server:123/nexus/content/repositories/mysoft_releases/</url>
</repository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>dependency.package.1</groupId>
<artifactId>connector-sdk-impl</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- datamodels -->
<dependency>
<groupId>dependency.package.1</groupId>
<artifactId>data-model-1</artifactId>
<version>3.6.5.0001</version>
</dependency>
<dependency>
<groupId>dependency.package.2</groupId>
<artifactId>data-model-2</artifactId>
<version>${scadasoft.version}</version>
</dependency>
<!--
...
-->
<dependency>
<groupId>my.package.for.mysoft</groupId>
<artifactId>mysoft-common</artifactId>
<version>${mysoft_version}</version>
</dependency>
<dependency>
<groupId>my.package.for.mysoft</groupId>
<artifactId>mysoft-jaxb</artifactId>
<version>${mysoft_version}</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<environmentVariables>
<PATH>${java.library.path};${my_api_dir}\Bin;${project.basedir}\..\module-with-cpp\target\nar\lib\x86-Windows-msvc\jni</PATH>
</environmentVariables>
<argLine>-Xmx1024m</argLine>
</configuration>
</plugin>
<!-- Maven Compiler plugin: Inherited from Parent -->
<!-- Maven Jar plugin: Inherited from Parent -->
<!-- Maven Check Style Plugin: Inherited from Parent -->
<!-- Maven Assembly Plugin Plugin: Inherited from Parent -->
<!-- Maven JavaDoc Plugin: Inherited from Parent -->
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>system_configuration/**</exclude>
<exclude>mysoft.properties</exclude>
<exclude>connector_configuration.xml</exclude>
<exclude>log4j.xml</exclude>
</excludes>
</configuration>
</plugin>
<!-- One of the dependencies uses C++ -->
<plugin>
<groupId>com.github.maven-nar</groupId>
<artifactId>nar-maven-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>nar-download</id>
<goals>
<goal>nar-download</goal>
</goals>
</execution>
<execution>
<id>nar-test-unpack</id>
<goals>
<goal>nar-test-unpack</goal>
</goals>
</execution>
<execution>
<id>nar-integration-test</id>
<goals>
<goal>nar-integration-test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Related
I'm exporting my java app into a single JAR file but when I try to execute it I always get the same error.
java.lang.NoClassDefFoundError: org/opengis/feature/type/Name
Apparently there is something wrong including the opengis dependencies.
I am using the shade plugin and the mvn package command to generate the JAR file.
Here I include 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>org.geotools</groupId>
<artifactId>DataEngine</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>DataEngine</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<geotools.version>23-SNAPSHOT</geotools.version>
<start-class>exe.Main</start-class>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-shapefile</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-swing</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-hsql</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geotiff</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-image</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-wms</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-graphx_2.12</artifactId>
<version>2.4.4</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-hive_2.12</artifactId>
<version>2.4.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.12</artifactId>
<version>2.4.4</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-jdbc</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-service</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.17</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.opengis</groupId>
<artifactId>geoapi</artifactId>
<version>3.0.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net repository</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>osgeo</id>
<name>Open Source Geospatial Foundation Repository</name>
<url>http://download.osgeo.org/webdav/geotools/</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>boundless</id>
<name>Boundless Maven Repository</name>
<url>http://repo.boundlessgeo.com/main</url>
</repository>
<repository>
<id>spark graphx</id>
<name>spark graphx</name>
<url>https://mvnrepository.com/artifact/org.apache.spark/spark-graphx</url>
</repository>
<repository>
<id>spark hive</id>
<name>spark hive</name>
<url>https://mvnrepository.com/artifact/org.apache.spark/spark-hive</url>
</repository>
<repository>
<id>spark sql</id>
<name>spark sql</name>
<url>https://mvnrepository.com/artifact/org.apache.spark/spark-sql</url>
</repository>
<repository>
<id>jdbc hive</id>
<name>jdbc hive</name>
<url>https://mvnrepository.com/artifact/org.apache.hive/hive-jdbc</url>
</repository>
<repository>
<id>hive service</id>
<name>hive service</name>
<url>https://mvnrepository.com/artifact/org.apache.hive/hive-service</url>
</repository>
<repository>
<id>mysql driver</id>
<name>mysql driver</name>
<url>https://mvnrepository.com/artifact/mysql/mysql-connector-java</url>
</repository>
<repository>
<id>commons-loggin</id>
<name>commons-loggin</name>
<url>https://mvnrepository.com/artifact/commons-logging/commons-logging</url>
</repository>
<repository>
<id>opengis</id>
<name>opengis</name>
<url>https://mvnrepository.com/artifact/org.opengis/geoapi</url>
</repository>
</repositories>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>exe.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<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}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<includes>
<include>junit:junit</include>
<include>org.geotools:gt-shapefile</include>
<include>org.geotools:gt-swing</include>
<include>org.geotools:gt-epsg-hsql</include>
<include>org.geotools:gt-geotiff</include>
<include>org.geotools:gt-image</include>
<include>org.geotools:gt-wms</include>
<include>org.apache.spark:spark-graphx_2.12</include>
<include>org.apache.spark:spark-hive_2.12</include>
<include>org.apache.spark:spark-sql_2.12</include>
<include>org.apache.hive:hive-jdbc</include>
<include>org.apache.hive:hive-service</include>
<include>mysql:mysql-connector-java</include>
<include>commons-logging:commons-logging</include>
<include>org.opengis:geoapi</include>
</includes>
</artifactSet>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>exe.Main</mainClass>
</transformer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Here the full error trace which I get:
Exception in thread "main" java.lang.NoClassDefFoundError: org/opengis/feature/type/Name
at exe.Main.initialize(Main.java:119)
at exe.Main.main(Main.java:86)
Caused by: java.lang.ClassNotFoundException: org.opengis.feature.type.Name
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more
I would really appreciate any help/suggestion. I've been stack at this point for quite a long time but still not getting any solution.
You should avoid the maven assembly plugin as it will cause you issues in the future. GeoTools modules often define one or more files in its META-INF/services directory with the same names as files defined in other modules. The assembly plugin just copies files with the same name over the top of each other rather than merging their contents.
The good news is that the Maven shade plugin can be used instead and it will correctly merge the META-INF/services files from each of the GeoTools modules used by your application.
See the FAQ for more details.
And finally, please use a stable release unless you are explicitly testing the release candidate for us (22-RC for example, became useless on the release of 22.0).
I've added this assembly plugin:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>exe.Main</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
But is still not working
**SOLVED: **
I just had to add <sourceDirectory>src/com/foobar</sourceDirectory> to <build> and execute the mvn clean compile assembly:single command.
There is another plugin if you want to build your entire app to a single jar: http://maven.apache.org/plugins/maven-assembly-plugin/
Maven assembly also support various type of packaging. You can consider using this if you cannot find a way to fix your current problem.
I'm trying to use maven-assembly-plugin to build an all-inclusive fat jar of my Spring Boot app.
I run mvn clean package, no jars are created.
What am I doing wrong?
My pom:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<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.github.vanroy</groupId>
<artifactId>spring-data-jest-build</artifactId>
<version>3.1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Spring Data Jest Build</name>
<description>Build configuration of Spring Data Implementation for Jest</description>
<url>https://github.com/vanroy/spring-data-jest</url>
<developers>
<developer>
<id>vanroy</id>
<name>Julien Roy</name>
<email>julien.vanroy#gmail.com</email>
<url>http://github.com/vanroy</url>
<timezone>+1</timezone>
<roles>
<role>Java Developer</role>
</roles>
</developer>
</developers>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
</license>
</licenses>
<scm>
<url>https://github.com/vanroy/spring-data-jest/</url>
<connection>scm:git:ssh://git#github.com/vanroy/spring-data-jest.git</connection>
<developerConnection>scm:git:ssh://git#github.com/vanroy/spring-data-jest.git</developerConnection>
</scm>
<properties>
<!-- Java Version -->
<java.version>1.8</java.version>
<encoding>UTF-8</encoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<!-- Dependencies version -->
<springboot>2.0.0.M4</springboot>
<spring>5.0.0.RELEASE</spring>
<springdataes>3.0.0.RELEASE</springdataes>
<jest>5.3.2</jest>
<gson>2.8.0</gson>
<awssigning>0.0.16</awssigning>
<springcloudaws>1.2.1.RELEASE</springcloudaws>
<jna>4.2.2</jna>
<hamcrest>1.3</hamcrest>
<junit>4.12</junit>
<lombok>1.16.8</lombok>
<mockito>1.10.19</mockito>
<logback>1.1.9</logback>
<aws>1.11.132</aws>
<elasticsearch>5.5.0</elasticsearch>
<!-- Version of maven plugins -->
<version.plugin.maven-compiler-plugin>3.6.1</version.plugin.maven-compiler-plugin>
<version.plugin.maven-deploy-plugin>2.8.2</version.plugin.maven-deploy-plugin>
<version.plugin.maven-surefire-plugin>2.20</version.plugin.maven-surefire-plugin>
<version.plugin.maven-source-plugin>2.1.2</version.plugin.maven-source-plugin>
<version.plugin.maven-javadoc-plugin>2.7</version.plugin.maven-javadoc-plugin>
<version.plugin.maven-release-plugin>2.5</version.plugin.maven-release-plugin>
<version.plugin.nexus-staging-maven-plugin>1.6.7</version.plugin.nexus-staging-maven-plugin>
<version.plugin.maven-gpg-plugin>1.6</version.plugin.maven-gpg-plugin>
<version.plugin.maven-spring-boot-plugin>1.5.3.RELEASE</version.plugin.maven-spring-boot-plugin>
<!-- Source encoding -->
<source.encoding>UTF-8</source.encoding>
</properties>
<dependencyManagement>
<dependencies>
<!-- Spring Data Elasticsearch -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-elasticsearch</artifactId>
<version>${springdataes}</version>
<exclusions>
<exclusion>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch}</version>
</dependency>
<!-- JEST -->
<dependency>
<groupId>io.searchbox</groupId>
<artifactId>jest</artifactId>
<version>${jest}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson}</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>${hamcrest}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>${hamcrest}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jolira</groupId>
<artifactId>onejar-maven-plugin</artifactId>
<version>1.4.4</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${version.plugin.maven-compiler-plugin}</version>
<configuration>
<compilerArgs>
<arg>-Xlint</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>${version.plugin.maven-deploy-plugin}</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.plugin.maven-surefire-plugin}</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${version.plugin.maven-spring-boot-plugin}</version>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-libs-snapshot</id>
<url>https://repo.spring.io/libs-snapshot</url>
</repository>
</repositories>
<!-- Deploy snapshots to the Sonatype OSSRH (OSS Repository Hosting) -->
<distributionManagement>
<downloadUrl>https://github.com/vanroy/spring-data-jest</downloadUrl>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<modules>
</modules>
</profile>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${version.plugin.maven-source-plugin}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${version.plugin.maven-javadoc-plugin}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${version.plugin.maven-release-plugin}</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<goals>deploy</goals>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.dfs.ace.catalog.api.SampleJestApplication.class</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
To build a JAR that contains all what is required to start the Spring Boot application, the most simple way is relying on the repackage goal of the
spring-boot-maven-plugin.
Of course you could do the same thing "at the hand" (with the maven-shade-plugin for example) but it may be error prone and is it really required in your case ?
So here is the needed configuration in the 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>
<!-- ... -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.9.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
repackage is bound to the package phase and will so be executed after the default package task.
So running this command will do the job:
mvn package
Note that you may also create the executable JAR of the application
without including the repackage execution in the pom.xml by specifying the goal from the command line :
mvn package spring-boot:repackage
I have a Spring Boot application and I can't figure out why I am getting this "Error: Could not find or load main class com.example....".
I am only getting this problem with the jar file, packaged with maven, which is including all dependencies. The jar file without dependencies is working just fine, as the whole project in STS. I have read this question (What does "Could not find or load main class" mean?) and all the linked articles and it still is above my head. I did everything suggested and in the end it still threw the same error. I do have now Main-Class: com.fully.qualified.name in my MANIFEST.MF in the created jar.
I might have a classpath issue as I feel from that article, as when I included the <addClasspath>true</addClasspath> in the maven plugin, I got some 150+ dependency jar files as Class-Path in my MANIFEST.MF file. These jar files are also in my jar\Boot-INF\lib, whereas my code files are in jar\BOOT-INF\classes. Do you think it has something to do with it and how can I solve this?
My POM:
<?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.fully.qualified</groupId>
<artifactId>name</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>example</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<scala.majorVersion>2.11</scala.majorVersion>
<scala.minorVersion>8</scala.minorVersion>
<start-class>com.fully.qualified.name.Demo</start-class>
</properties>
<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
</repository>
<repository>
<id>pele.farmbio.uu.se</id>
<url>http://pele.farmbio.uu.se/artifactory/libs-snapshot</url>
</repository>
<repository>
<id>scala-tools.org</id>
<name>Scala-tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.majorVersion}.${scala.minorVersion}</version>
<exclusions>
<exclusion>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.19.3</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.5</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.lamma</groupId>
<artifactId>lamma_2.11</artifactId>
<version>2.2.2</version>
</dependency>
<!-- fix java.lang.ClassNotFoundException: org.codehaus.commons.compiler.UncheckedCompileException -->
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>commons-compiler</artifactId>
<version>2.7.8</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/log4j-over-slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId>
<version>1.7.25</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
<executions>
<execution>
<id>default-compile</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<recompileMode>incremental</recompileMode>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.fully.qualified.name.Demo</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>assemble-all</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
</plugins>
<!-- Following is to remove pom errors only -->
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
net.alchim31.maven
</groupId>
<artifactId>
scala-maven-plugin
</artifactId>
<versionRange>
[2.15.2,)
</versionRange>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Java command: java -jar example-0.0.1-SNAPSHOT-jar-with-dependencies.jar
java -jar example-0.0.1-SNAPSHOT.jar works just fine.
Thanks.
I am using Cucumber in a Maven project in Eclipse to launch SoapUI.
My POM.xml file works quite well when running from within Eclipse, the test completes with no errors.
However, when I launch from the command line with "mvn test" I get this error:
pom.xml: Unrecognised tag: 'soapuiProperties' (position: START_TAG seen ...\r\n \r\n ..
Here is the 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>Project_name</groupId>
<artifactId>Project_name</artifactId>
<version>0.0.1-SNAPSHOT</version>
<parent>
<groupId>com.smartbear</groupId>
<artifactId>ready-api</artifactId>
<version>1.7.0</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<repositories>
<repository>
<id>SmartBearPluginRepository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</repository>
<repository>
<id>maven2-repository.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://java.net/projects/maven-repository/</url>
<layout>default</layout>
</repository>
</repositories>
<!--Adding SoapUI Maven plugin-->
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>http://www.soapui.org/repository/maven2/</url>
<soapuiProperties>
<property>
<name>soapui.home</name>
<value>C:\Program Files\SmartBear\ReadyAPI\bin</value>
</property>
</soapuiProperties>
</pluginRepository>
</pluginRepositories>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.3</version>
<configuration>
<createChecksum>true</createChecksum>
<updateReleaseInfo>true</updateReleaseInfo>
<tasks>
<copy file="pom.xml"
tofile="${project.build.directory}/ready-api-maven-plugin-${project.version}.pom"/>
</tasks>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<outputDirectory>${assembly.build.directory}</outputDirectory>
<descriptors>
<descriptor>src/main/assembly/public-pom.xml</descriptor>
</descriptors>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui</artifactId>
<version>5.2.1</version>
<scope>compile</scope>
<!-- <executions>
<execution>
<phase>test
</phase>
<goals>
<goal>test
</goal>
</goals>
<configuration>
<projectFile>C:\\Users\\charles\\test-automation\\Soapui\\Project_name-REST-soapui-project.xml</projectFile>
</configuration>
</execution>
</executions> -->
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
</dependencies>
</project>
Any idea how I need to fix the POM ? I tried moving the SoapUIproperties block into and out of the pluginrepsositories block, but there result is the same.
The error
pom.xml: Unrecognised tag: 'soapuiProperties' (position: START_TAG seen ...\r\n \r\n ..
means that you've malformed POM file (pom.xml). In other words you have placed soapuiProperties tag in the wrong place.
You need to move soapuiProperties to build/plugins/plugin/configuration for soapui-maven-plugin. So here is the snippet of how correct pom.xml should look like:
<pluginRepositories>
<pluginRepository>
<id>smartbear-sweden-plugin-repository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>5.2.1</version>
<configuration>
<projectFile>soapui-tests.xml</projectFile>
<soapuiProperties>
<property>
<name>soapui.logroot</name>
<value>${project.build.directory}/soapui-logs/</value>
</property>
</soapuiProperties>
</configuration>
</plugin>
</plugins>
The soapuiProperties is not a valid child of the pluginRepository element.
The pluginRepositories section declares where maven will attempt to find and download plugins from.
It does not appear that you are making use of the SoapUI plugin so you can probably remove the pluginRepositories section.
The placement of the soapuiProperties suggests that it is not being used by the test so you can probably remove it.
I've wrote my own custom Maven plugin and uploaded it to my Archiva server. It works fine with the full name specified:
mvn com.mjolnirr:maven-plugin:manifest
But when I want to do it via the prefix, it fails:
mvn mjolnirr:manifest
[ERROR] No plugin found for prefix 'mjolnirr' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/home/sk_/.m2/repository), mjolnirr (http://mjolnirr.dyndns.org/archiva/repository/plugins), central (http://repo.maven.apache.org/maven2)] -> [Help 1]
My plugin's 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.mjolnirr</groupId>
<artifactId>mjolnirr-maven-plugin</artifactId>
<version>0.2</version>
<packaging>maven-plugin</packaging>
<name>Mjolnirr Maven Plugin</name>
<url>http://mjolnirr.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>mjolnirr</id>
<name>Mjolnirr snapshot repository</name>
<url>http://mjolnirr.com/archiva/repository/snapshots</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>mjolnirr</id>
<name>Maven Plugin Repository</name>
<url>http://mjolnirr.com/archiva/repository/snapshots</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.8</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<!-- For superclass resolving -->
<dependency>
<groupId>com.mjolnirr</groupId>
<artifactId>core</artifactId>
<version>0.2</version>
</dependency>
<!-- For XML producing -->
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<configuration>
<goalPrefix>mjolnirr</goalPrefix>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
<execution>
<id>help-goal</id>
<goals>
<goal>helpmojo</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>run-its</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-invoker-plugin</artifactId>
<version>1.7</version>
<configuration>
<debug>true</debug>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<pomIncludes>
<pomInclude>*/pom.xml</pomInclude>
</pomIncludes>
<postBuildHookScript>verify</postBuildHookScript>
<localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
<settingsFile>src/it/settings.xml</settingsFile>
<goals>
<goal>clean</goal>
<goal>test-compile</goal>
</goals>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>install</goal>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
It looks like I have to put some definition into my repository. Can you help me?
ADD I've discovered that maven trying to download maven-metadata.xml from org/apache/maven/plugins. Is it possible to change this path in the project POM, without changing the maven settings?
Only plugins with a groupId of org.apache.maven.plugins will be searched by default.
To get Maven to search additional groupIds for plugins, additional plugin groups can be configured in each user's settings.xml file, e.g.:
<pluginGroups>
<pluginGroup>org.mortbay.jetty</pluginGroup>
<pluginGroup>org.apache.tomcat.maven</pluginGroup>
</pluginGroups>
More information on this in the Maven plugin guide.