Hi I've got a basic Jersey Client that I'm trying to run with a main() in my "main" java class. It compiles fine in Eclipse, but when I try to run it as java application, I get:
Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.client.JerseyClientBuilder
Can anyone tell me what I'm doing wrong? Here's 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ca.ubc.iamwsClient</groupId>
<artifactId>iamwsClient</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>iamwsClient</name>
<properties>
<jersey.version>2.5.1</jersey.version>
<target.dir>target</target.dir>
<project.build.directory>target</project.build.directory>
</properties>
<repositories>
<repository>
<id>JBoss Repository</id>
<url>https://repository.jboss.org/nexus/content/groups/public</url>
</repository>
</repositories>
<dependencies>
<!-- jackson dependencies for pojo/json support -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-processing</artifactId>
<version>${jersey.version}</version>
</dependency>
<!-- end jackson deps -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey.version}</version>
</dependency>
<!-- <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId>
<version>1.8</version> </dependency> -->
<dependency>
<groupId>org.glassfish.jersey.connectors</groupId>
<artifactId>jersey-apache-connector</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0</version>
</dependency>
<!-- <dependency> <groupId>javax.ws.rs</groupId> <artifactId>jsr311-api</artifactId>
<version>1.1</version> </dependency> -->
</dependencies>
<build>
<finalName>iamwsClient</finalName>
<outputDirectory>${basedir}/${target.dir}/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
</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}/classes/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<!-- copy-dependency plugin -->
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[0.0,)</versionRange>
<goals>
<goal>copy-dependencies</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
<!-- <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>ca.ubc.iamwsClient.IamwsClient</mainClass>
</configuration>
</plugin> -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>ca.ubc.iamwsClient.IamwsClient</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
<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>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-dependency-plugin
</artifactId>
<versionRange>
[2.1,)
</versionRange>
<goals>
<goal>
copy-dependencies
</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Client that I'm trying to run:
package ca.ubc.iamwsClient;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.glassfish.jersey.jackson.JacksonFeature;
import ca.ubc.iamwsClient.json.CreateEmployeeBean;
import ca.ubc.iamwsClient.json.CreateEmployeeResponseBean;
/**
* Main class.
*
*/
public class IamwsClient {
private WebTarget getTarget(String targetUrl) throws Exception {
// create the client
Client c = ClientBuilder.newClient().register(JacksonFeature.class);
return c.target(targetUrl);
}
public CreateEmployeeResponseBean sendCreateEmployeeRequest(CreateEmployeeBean createBean, String url) {
CreateEmployeeResponseBean rb = null;
try {
WebTarget target = getTarget(url);
WebTarget wt = target.path("employeeAutoCreate");
WebTarget generateTarget = wt.path("generate");
rb = generateTarget.request(MediaType.APPLICATION_JSON_TYPE).post(Entity.entity(createBean,MediaType.APPLICATION_FORM_URLENCODED_TYPE),
CreateEmployeeResponseBean.class);
System.out.println("CreateEmployee: generate response: success=" + rb.getSuccess() + " message=" + rb.getMessage());
} catch (Throwable t) {
t.printStackTrace();
System.out.println("*********EXCEPTION THROWN: " + t.getMessage());
}
return rb;
}
public static void main(String[] args) {
String testUrl="http://localhost:9090/iamws";
CreateEmployeeBean bean = new CreateEmployeeBean();
// ... set some details on bean....
IamwsClient client = new IamwsClient();
CreateEmployeeResponseBean response = client.sendCreateEmployeeRequest(bean, testUrl);
if (response != null) {
System.out.println("*********server responded with flag: " + response.getSuccess() + " message: " + response.getMessage());
}
}
}
You need to make sure that the JAR dependency containing org.glassfish.jersey.client.JerseyClientBuilder class is available on your application's classpath during the run time. There's really no other explanation to NoClassDefFound error.
From what I can google on this class, it should be available in
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.0-m04</version>
</dependency>
In other words your com.sun.jersey dependency may be missing it.
EDIT
This is the actual answer which the OP added to the Question afterwards:
<jersey.version>2.5.1</jersey.version>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-processing</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.0</version>
</dependency>
He already had org.glassfish.jersey.core and org.glassfish.jersey.connectors. He removed com.sun.jersey dependency.
I am going to try this myself shortly.
Related
Here is the tutorial I'm following.
The pom.xml file is the default one that comes with the dl4j examples folder so there shouldn't be issues there but it still has errors.
Here's the code:
package org.deeplearning4j.self;
import org.deeplearning4j.datasets.iterator.impl.EmnistDataSetIterator;
import org.deeplearning4j.nn.conf.MultiLayerConfiguration;
import org.deeplearning4j.nn.conf.NeuralNetConfiguration;
import org.deeplearning4j.nn.conf.layers.DenseLayer;
import org.deeplearning4j.nn.conf.layers.OutputLayer;
import org.deeplearning4j.nn.multilayer.MultiLayerNetwork;
import org.deeplearning4j.nn.weights.WeightInit;
import org.nd4j.linalg.activations.Activation;
import org.nd4j.linalg.learning.config.Adam;
import org.nd4j.linalg.lossfunctions.LossFunctions;
import java.io.IOException;
public class first {
int batchSize = 128; // how many examples to simultaneously train in the network
EmnistDataSetIterator.Set emnistSet = EmnistDataSetIterator.Set.BALANCED;
EmnistDataSetIterator emnistTrain;
{ try { emnistTrain = new EmnistDataSetIterator(emnistSet, batchSize, true); } catch (IOException e) { e.printStackTrace(); } }
EmnistDataSetIterator emnistTest;
{ try { emnistTest = new EmnistDataSetIterator(emnistSet, batchSize, false); } catch (IOException e) { e.printStackTrace(); } }
int outputNum = EmnistDataSetIterator.numLabels(emnistSet);// total output classes
int rngSeed = 123; // integer for reproducability of a random number generator
int numRows = 28; // number of "pixel rows" in an mnist digit
int numColumns = 28;
MultiLayerConfiguration conf = new NeuralNetConfiguration.Builder()
.seed(rngSeed)
.updater(new Adam())
.l2(1e-4)
.list()
.layer(new DenseLayer.Builder()
.nIn(numRows * numColumns) // Number of input datapoints.
.nOut(1000) // Number of output datapoints.
.activation(Activation.RELU) // Activation function.
.weightInit(WeightInit.XAVIER) // Weight initialization.
.build())
.layer(new OutputLayer.Builder(LossFunctions.LossFunction.NEGATIVELOGLIKELIHOOD)
.nIn(1000)
.nOut(outputNum)
.activation(Activation.SOFTMAX)
.weightInit(WeightInit.XAVIER)
.build())
.build();
MultiLayerNetwork network = new MultiLayerNetwork(conf);
network.init();
// pass a training listener that reports score every 10 iterations
int eachIterations = 10;
network.addListeners(new ScoreIterationListener(eachIterations));
}
I'm using IntelliJ.
The errors I'm getting in the class is:
Both methods called on "network" aren't recognized, both "init()" and "addListeners()" have "Cannot resolve symbol" on them. It also says on "network" that the "Field network is never used".
Additionally the int "eachIterations" has an "Unknown class" error inside of the addListeners() method.
Here's the pom.xml file:
<?xml version="1.0" encoding="UTF-8"?> <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ Copyright (c) 2020 Konduit K.K. ~ Copyright (c) 2015-2019 Skymind, Inc. ~ ~ This program and the accompanying materials are made available under the ~ terms of the Apache License, Version 2.0 which is available at ~ https://www.apache.org/licenses/LICENSE-2.0. ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT ~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the ~ License for the specific language governing permissions and limitations ~ under the License. ~ ~ SPDX-License-Identifier: Apache-2.0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<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.deeplearning4j</groupId>
<artifactId>dl4j-examples</artifactId>
<version>1.0.0-beta7</version>
<name>Introduction to DL4J</name>
<description>A set of examples introducing the DL4J framework</description>
<properties>
<dl4j-master.version>1.0.0-beta7</dl4j-master.version>
<!-- Change the nd4j.backend property to nd4j-cuda-X-platform to use CUDA GPUs -->
<!-- <nd4j.backend>nd4j-cuda-10.2-platform</nd4j.backend> -->
<nd4j.backend>nd4j-native</nd4j.backend>
<java.version>1.8</java.version>
<maven-compiler-plugin.version>3.6.1</maven-compiler-plugin.version>
<maven.minimum.version>3.3.1</maven.minimum.version>
<exec-maven-plugin.version>1.4.0</exec-maven-plugin.version>
<maven-shade-plugin.version>2.4.3</maven-shade-plugin.version>
<jcommon.version>1.0.23</jcommon.version>
<jfreechart.version>1.0.13</jfreechart.version>
<logback.version>1.1.7</logback.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.29</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
<version>4.1.48.Final</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>${nd4j.backend}</artifactId>
<version>${dl4j-master.version}</version>
</dependency>
<dependency>
<groupId>org.datavec</groupId>
<artifactId>datavec-api</artifactId>
<version>${dl4j-master.version}</version>
</dependency>
<dependency>
<groupId>org.datavec</groupId>
<artifactId>datavec-data-image</artifactId>
<version>${dl4j-master.version}</version>
</dependency>
<dependency>
<groupId>org.datavec</groupId>
<artifactId>datavec-local</artifactId>
<version>${dl4j-master.version}</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-datasets</artifactId>
<version>${dl4j-master.version}</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-core</artifactId>
<version>${dl4j-master.version}</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-ui</artifactId>
<version>${dl4j-master.version}</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-zoo</artifactId>
<version>${dl4j-master.version}</version>
</dependency>
<!-- ParallelWrapper & ParallelInference live here -->
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-parallel-wrapper</artifactId>
<version>${dl4j-master.version}</version>
</dependency>
<!-- Used in the feedforward/classification/MLP* and feedforward/regression/RegressionMathFunctions example -->
<dependency>
<groupId>jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>${jfreechart.version}</version>
</dependency>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jcommon</artifactId>
<version>${jcommon.version}</version>
</dependency>
<!-- Used for downloading data in some of the examples -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.5</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>org.datavec</groupId>
<artifactId>datavec-data-codec</artifactId>
<version>${dl4j-master.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacv-platform</artifactId>
<version>1.5.2</version>
</dependency>
</dependencies>
<!-- Maven Enforcer: Ensures user has an up to date version of Maven before building -->
<build>
<plugins>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>enforce-default</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>[${maven.minimum.version},)</version>
<message>********** Minimum Maven Version is ${maven.minimum.version}. Please upgrade Maven before continuing (run "mvn --version" to check). **********</message>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>com.lewisd</groupId>
<artifactId>lint-maven-plugin</artifactId>
<version>0.0.11</version>
<configuration>
<failOnViolation>true</failOnViolation>
<onlyRunRules>
<rule>DuplicateDep</rule>
<rule>RedundantPluginVersion</rule>
<!-- Rules incompatible with Java 9
<rule>VersionProp</rule>
<rule>DotVersionProperty</rule> -->
</onlyRunRules>
</configuration>
<executions>
<execution>
<id>pom-lint</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${maven-shade-plugin.version}</version>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>${shadedClassifier}</shadedClassifierName>
<createDependencyReducedPom>true</createDependencyReducedPom>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>org/datanucleus/**</exclude>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>com.lewisd</groupId>
<artifactId>lint-maven-plugin</artifactId>
<versionRange>[0.0.11,)</versionRange>
<goals>
<goals><goal>check</goal></goals>
</goals>
</pluginExecutionFilter>
<action>
<ignore/>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build> </project>
The error here is "${shadedClassifier}" shadedClassifier is red and the error is: "Cannot resolve symbol 'shadedClassifier'"
So I reinstalled maven with "mvn clean install" but it still doesn't work.
Maven has installed correctly with clean install but still I have these errors.
Please any help would be appriciated. I've been stuck on this for a week and I really want to learn machine learning.
I'm guessing maven isn't setup properly. I would ensure the IDE is up to date. Right clicking on the project in intellij and hitting reload is something I would consider doing. Same answer as here: Force Intellij IDEA to reread all maven dependencies
Trying to create a java-se application using DataNucleus for dinamic generation of persistance unit by this code (which is in main method of Main class):
PersistenceUnitMetaData pumd = new PersistenceUnitMetaData("dynamic-unit", "RESOURCE_LOCAL", null);
pumd.addClassName("my.homework.entity.Procurement");
pumd.addProperty("datanucleus.ConnectionDriverName", "com.mysql.cj.jdbc.Driver");
pumd.addProperty("datanucleus.ConnectionURL", "jdbc:mysql://localhost:3306/" + schemaName + "?serverTimezone=Asia/Yekaterinburg");
pumd.addProperty("datanucleus.ConnectionUserName", login);
pumd.addProperty("datanucleus.ConnectionPassword", password);
pumd.addProperty("datanucleus.schema.autoCreateTables", "true");
EntityManagerFactory emf = new JPAEntityManagerFactory(pumd, null);
entityManager = emf.createEntityManager();
ProcurementService procurementService = new ProcurementService(entityManager);
In idea the code works well. But when I'm trying to run application as an .exe file in Windows, I'm getting the error:
ш■ы 21, 2020 11:46:04 PM org.datanucleus.api.ApiAdapterFactory getApiAdapter
SEVERE: Error : Could not find API definition for name "JPA". Perhaps you dont have the requisite datanucleus-api-XXX jar in the CLASSPATH?
Exception in thread "main" Error : Could not find API definition for name "JPA". Perhaps you dont have the requisite datanucleus-api-XXX jar in the CLASSPATH?
org.datanucleus.exceptions.NucleusUserException: Error : Could not find API definition for name "JPA". Perhaps you dont have the requisite datanucleus-api-XXX jar in the CLASSPATH?
at org.datanucleus.api.ApiAdapterFactory.getApiAdapter(ApiAdapterFactory.java:93)
at org.datanucleus.AbstractNucleusContext.<init>(AbstractNucleusContext.java:118)
at org.datanucleus.PersistenceNucleusContextImpl.<init>(PersistenceNucleusContextImpl.java:185)
at org.datanucleus.PersistenceNucleusContextImpl.<init>(PersistenceNucleusContextImpl.java:174)
at org.datanucleus.api.jpa.JPAEntityManagerFactory.initialiseNucleusContext(JPAEntityManagerFactory.java:909)
at org.datanucleus.api.jpa.JPAEntityManagerFactory.initialise(JPAEntityManagerFactory.java:515)
at org.datanucleus.api.jpa.JPAEntityManagerFactory.<init>(JPAEntityManagerFactory.java:380)
at my.homework.Main.main(Main.java:109)
Main.java:109:
EntityManagerFactory emf = new JPAEntityManagerFactory(pumd, null);
POM file:
<?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>my.homework</groupId>
<artifactId>Dinar8</artifactId>
<version>1.0</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>https://repository.aspose.com/repo/</url>
</repository>
<repository>
<id>akathist-repository</id>
<name>Akathist Repository</name>
<url>http://www.9stmaryrd.com/maven</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-cells</artifactId>
<version>20.3</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.20</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>5.4.15.Final</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.10</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>5.2.4</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rdbms</artifactId>
<version>5.2.3</version>
</dependency>
</dependencies>
<pluginRepositories>
<pluginRepository>
<id>akathist-repository</id>
<name>Akathist Repository</name>
<url>http://www.9stmaryrd.com/maven</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>
my.homework.Main
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>1.7.25</version>
<executions>
<execution>
<id>l4j-console</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>console</headerType>
<outfile>target/Project13.exe</outfile>
<jar>target/Dinar8-1.0-SNAPSHOT-jar-with-dependencies.jar</jar>
<dontWrapJar>false</dontWrapJar>
<errTitle>Error in launch4j plugin</errTitle>
<classPath>
<mainClass>my.homework.Main</mainClass>
<addDependencies>true</addDependencies>
</classPath>
<jre>
<path>%JAVA_HOME%</path>
<jdkPreference>jdkOnly</jdkPreference>
<minVersion>1.7.0</minVersion>
<runtimeBits>64/32</runtimeBits>
<maxHeapPercent>100</maxHeapPercent>
</jre>
<icon>src/main/resources/icon13.ico</icon>
<versionInfo>
<fileVersion>1.0.0.0</fileVersion>
<txtFileVersion>1.0.0.0</txtFileVersion>
<fileDescription>Excel file analysis</fileDescription>
<copyright>Khmelev Stanislav</copyright>
<companyName>comp</companyName>
<productVersion>1.0.0.0</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<productName>Project13</productName>
<internalName>Project13</internalName>
<originalFilename>Project13.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-maven-plugin</artifactId>
<version>5.0.2</version>
<configuration>
<api>JPA</api>
<log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
What should I do to remove this error?
Putting all three jar files:
datanucleus-api-jpa-5.2.4.jar,
datanucleus-core-5.2.3.jar,
datanucleus-rdbms-5.2.3.jar
into the directory with .exe solving the problem.
I have a collection of Java projects. It is a series of APIs. I am generating much of the server code from the swagger definition using swagger codegen. I'm using spring-boot with the delegate pattern, so my generated code all goes to src/gen/java/main and I can write my implementation code in src/main/java. The generated code is not version controlled, but re-generated as needed by the maven swagger codegen plugin. All this works nicely :)
However, when I first import the projects into Eclipse (using "import existing maven project" on the parent project to import them all) I get a bunch of "unused function" type warnings from the generated code. (I add the src/gen/java/main folder as a source folder using the build-helper-maven-plugin.) If I select the src/gen/java/main folder in each project, right-click, choose properties and say Ignore optional compile problems then this goes away (I also mark it as a derived resource)
Question: is there some way to mark this folder in the pom so that when I (or a colleague) imports the project into Eclipse, these settings are already set on that folder? Alternatively, some way to tell eclipse to always treat folders with the name (relative to project route) in that fashion?
Additional Info
I was asked for the pom file in a comment. I have done a fairly minimal example:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example.api</groupId>
<artifactId>com.example.api</artifactId>
<packaging>jar</packaging>
<name>Example</name>
<version>1.0-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<springfox-version>2.7.0</springfox-version>
<swagger.codegen.version>2.4.0-SNAPSHOT</swagger.codegen.version>
<jetty-version>9.2.15.v20160210</jetty-version>
<slf4j-version>1.7.21</slf4j-version>
<junit-version>4.12</junit-version>
<servlet-api-version>2.5</servlet-api-version>
<springfox-version>2.7.0</springfox-version>
<jackson-version>2.8.9</jackson-version>
<jackson-threetenbp-version>2.6.4</jackson-threetenbp-version>
<spring-version>4.3.9.RELEASE</spring-version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
</parent>
<build>
<sourceDirectory>src/main/java</sourceDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<versionRange>${swagger.codegen.version}</versionRange>
<goals>
<goal>generate</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<mainClass>${start-class}</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.example.api.Swagger2SpringBoot</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>
<!-- Needed to create swagger bits in asynch manner -->
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>${swagger.codegen.version}</version>
<executions>
<execution>
<id>foo</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/spec/foo.yaml</inputSpec>
<modelPackage>com.example.api.models</modelPackage>
<apiPackage>com.example.api</apiPackage>
<language>spring</language>
<invokerPackage>com.example.api</invokerPackage>
<basePackage>com.example.api</basePackage>
<withXml>true</withXml>
<configOptions>
<artifactId>bookings</artifactId>
<artifactDescription>Bookings API</artifactDescription>
<title>Bookings API</title>
<artifactUrl>https://api.example.com/foo</artifactUrl>
<groupId>com.example.api</groupId>
<artifactVersion>1.0</artifactVersion>
<configPackage>com.example.api.config</configPackage>
<serializableModel>true</serializableModel>
<dateLibrary>java8</dateLibrary>
<java8>true</java8>
<async>true</async>
<library>spring-boot</library>
<delegatePattern>true</delegatePattern>
<useBeanValidation>true</useBeanValidation>
<useOptional>true</useOptional>
<hideGenerationTimestamp>true</hideGenerationTimestamp>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty-version}</version>
<configuration>
<webAppConfig>
<contextPath>/v2</contextPath>
</webAppConfig>
<webAppSourceDirectory>target/${project.artifactId}-${project.version}</webAppSourceDirectory>
<stopPort>8079</stopPort>
<stopKey>stopit</stopKey>
<httpConnector>
<port>8002</port>
<idleTimeout>60000</idleTimeout>
</httpConnector>
</configuration>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!--SpringFox dependencies -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${springfox-version}</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox-version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
<!-- Bean Validation API support -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>
</dependencies>
</project>
This uses a minimal foo.yaml:
swagger: '2.0'
info:
title: Foo API
description: Test case
version: 1.0
host: api.example.com
basePath: /
schemes:
- https
consumes:
- application/json
produces:
- application/json
tags:
- name: foo
parameters:
message:
name: message
in: body
description: Foo
schema:
$ref: '#/definitions/Message'
required: true
definitions:
Message:
type: object
description: Foo
properties:
heading:
type: string
description: heading
body:
type: string
description: body
paths:
/foo:
post:
summary: foo
operationId: postFoo
tags:
- foo
parameters:
- $ref: '#/parameters/message'
responses:
'202':
description: Messages will be sent
default:
description: An unexpected error occurred
If I just mvn clean compile then import this the it's fine. However, if I add any implementation code that uses the generated code then it isn't.
For example, I added a package com.example.api.implementation to src/main/java containing a file FooApi.java which was:
package com.example.api.implementation;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import javax.servlet.http.HttpServletRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import com.example.api.FooApiDelegate;
import com.example.api.models.Message;
import com.fasterxml.jackson.databind.ObjectMapper;
#Component
public class FooApi implements FooApiDelegate {
private final ObjectMapper objectMapper;
private final HttpServletRequest request;
public Optional<ObjectMapper> getObjectMapper() {
return Optional.ofNullable(objectMapper);
}
public Optional<HttpServletRequest> getRequest() {
return Optional.ofNullable(request);
}
#org.springframework.beans.factory.annotation.Autowired
public FooApi(ObjectMapper objectMapper, HttpServletRequest request) {
this.objectMapper = objectMapper;
this.request = request;
}
#Override
public CompletableFuture<ResponseEntity<Void>> postFoo( Message message) {
return new CompletableFuture<ResponseEntity<Void>>();
}
}
If I now import, I get errors FooApiDelegate cannot be resolved to a type and Message cannot be resolved to a type (and for the corresponding imports) from my non.generated file.
There are at least two issues. The first thing is that you explicitly suppressed the execution of the code generation by using org.eclipse.m2e.. this will suppress any kind of generation you might have. Furthermore you are using a 2.4.0-SNAPSHOT where you should use 3.0.0-rc0 instead. Unfortunately the 3.0.0-rc0 has failured so you should stick with 2.3.1 which is a release instead of SNAPSHOT's.
Apart from that the plugin is missing also things are not correctly handled...If you cleanly import the project in Eclipse you will get a dialog about Setup Maven Plugin Connectors. Furthermore the plugin does not correctly handle the update in Eclipse context which can be done...
If you import the project and manually add the source folders from target/generated-sources this will work but unfortunately not allways...
I have created maven project for cucumber test cases with eclipse. On running the project through maven test , it runs perfectly fine and on running maven install, it creates the maven jar file containing all the classes.
However on running the jar file I am getting error:
java.lang.NoDefFoundError:cucumber/api/cli/Main .
I get no such errors on running the project through eclipse. I went through certain sites and realized it has something to do with the classpath. So I set the classpath and project directory as shown below. Also added classpath for manifest with pom.xml. Still after creating the jar I am getting the same error.
Please find my POM.xml :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.cucumber</groupId>
<artifactId>BsMonitor</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>BsMonitor</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.1.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-picocontainer</artifactId>
<version>1.1.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.1.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.53.0</version>
</dependency>
<dependency>
<groupId>com.codeborne</groupId>
<artifactId>phantomjsdriver</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.sonarsource.sonarlint.core</groupId>
<artifactId>sonarlint-core</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.1.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-jvm -->
<!-- https://mvnrepository.com/artifact/info.cukes/cucumber-jvm -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.cucumber.Base.NewMain</mainClass>
</transformer>
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<!-- Additional configuration. -->
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.cucumber.base.NewMain</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
My NewMain method calls the feature file :
package com.cucumber.Base;
import java.io.File;
import java.io.IOException;
import cucumber.api.cli.Main;
public class NewMain {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("Before caling PhantomJS");
File f = new File("C:\\Test\\text.txt");
if (f.exists())
f.delete();
try {
f.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
// org.junit.runner.JUnitCore.main("com.cucumber.tests.RunnerTest");
Main.main(new String[] { "-g", "com.cucumber.tests", "src/test/resource/features.feature" });
} catch (Throwable e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println(e);
}
System.out.println("after caling PhantomJS");
}
}
This is my classpath set in the environment variables : [classpath in my system][1]
When I opened the Jar my manifest file had these files in its classpath:
[manifest file][2]
[1]: https://i.stack.imgur.com/Ztewk.png
[2]: https://i.stack.imgur.com/dit8m.png
Please let me know how i can make this work on running a jar file . ANy help would be great .
I'm trying to write my own custom maven plugin which extends AbstractDependencyMojo.
Problem is that all the AbstractDependencyMojo components are null on code execution of my plugin.
#goal generate-dependencies
#phase install
#requiresProject false
See code below, overriding method execute()
public void execute() throws MojoExecutionException {
List<Dependency> dependencies = project.getModel().getDependencies();
for (Dependency dependency : dependencies) {
try {
Artifact a = factory.createArtifact(dependency.getGroupId(), dependency.getArtifactId(), dependency.getVersion(), dependency.getScope(), dependency.getType());
resolver.resolve(a, remoteRepos, getLocal());
}
catch (ArtifactResolutionException e) {
throw new MojoExecutionException("Implicit artifact resolution failed", e);
}
catch (ArtifactNotFoundException e) {
// Do nothing
}
}
While debugging, project is null, factory is null, well everything is .. null.
Obviously the components injection is not working at all for some reasons, and I can't figure out why ....
The plugin is being called this way:
<plugin>
<groupId>com.me.framework</groupId>
<artifactId>plugin-dependency-plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<executions>
<execution>
<id>plugin-dependencies</id>
<phase>install</phase>
<goals>
<goal>generate-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
Do you have any idea ? Thanks
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.me.framework</groupId>
<artifactId>plugin-dependency-plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model-builder</artifactId>
<version>3.0.4</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<type>maven-plugin</type>
<version>2.5.1</version>
</dependency>
</dependencies>
<build>
<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>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<versionRange>[3.2,)</versionRange>
<goals>
<goal>descriptor</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Calling plugin 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>
<artifactId>TheArtifact</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<executions>
<execution>
<id>clean-generated-sources</id>
<phase>clean</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<!-- Package project as artifact (for apidoc) -->
<execution>
<id>package-project</id>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.me.framework</groupId>
<artifactId>plugin-dependency-plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<executions>
<execution>
<id>plugin-dependencies</id>
<phase>install</phase>
<goals>
<goal>generate-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Install project resources as artifact (for apidoc) -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>install-project</id>
<phase>prepare-package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
First the documentation based markups are obsolete, it's better to use #Mojo annotation to provide all plugin details:
#Mojo(
name = "generate-dependencies",
defaultPhase = LifecyclePhase.INSTALL,
requiresDependencyResolution = ResolutionScope.COMPILE
// ...
)
Secondly, I would check the #requiresProject being set to false and try setting to true instead, could be the cause as well.