java.lang.securityexception error in my javafx with maven - maven

please help me debug this code. I am experiencing a java.lang.securityexception once I add the dynamic reports dependency in my POM. I have tried all suggested solutions provided here to no avail.This is my POM file structure
<?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>re.iprocu</groupId>
<artifactId>CoperativeERP</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>CoperativeERP</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>re.iprocu.coperativeerp.MainApp</mainClass>
</properties>
<organization>
<!-- Used as the 'Vendor' for JNLP generation -->
<name>Your Organisation</name>
</organization>
<dependencies>
<!-- DynamicReports -->
<dependency>
<groupId>net.sourceforge.dynamicreports</groupId>
<artifactId>dynamicreports-core</artifactId>
<version>3.1.3</version>
</dependency>
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>8.40.10</version>
</dependency>
<dependency>
<groupId>de.jensd</groupId>
<artifactId>fontawesomefx</artifactId>
<version>8.9</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>2.4.6</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- <plugin>
<groupId>com.zenjava</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>8.1.4</version>
<configuration>
<mainClass>re.iprocu.coperativeerp.MainApp</mainClass>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<id>create-jfxjar</id>
<phase>package</phase>
<goals>
<goal>build-jar</goal>
</goals>
</execution>
<execution>
<id>create-native</id>
<phase>package</phase>
<goals>
<goal>build-native</goal>
</goals>
</execution>
</executions>
</plugin> -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<excludeScope>system</excludeScope>
<excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<mainClass>re.iprocu.coperativeerp.MainApp</mainClass>
<executable>${java.home}/../bin/javafxpackager</executable>
<arguments>
<argument>-createjar</argument>
<argument>-nocss2bin</argument>
<argument>-appclass</argument>
<argument>${mainClass}</argument>
<argument>-srcdir</argument>
<argument>${project.build.directory}/classes</argument>
<argument>-outdir</argument>
<argument>${project.build.directory}</argument>
<argument>-outfile</argument>
<argument>${project.build.finalName}.jar</argument>
</arguments>
<filters>
<filter>
<!--
Exclude files that sign a jar
(one or multiple of the dependencies).
One may not repack a signed jar without
this, or you will get a
SecurityException at program start.
-->
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/*.INF</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
<execution>
<id>default-cli</id>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/bin/java</executable>
<commandlineArgs>${runfx.args}</commandlineArgs>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArguments>
<bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>${java.home}/lib/jfxrt.jar</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
</plugins>
</build>
</project>
and below is the error message i am getting once i run the program:-
java.lang.SecurityException: no manifiest section for signature file entry org/bouncycastle/jce/provider/JDKMessageDigest$RIPEMD256.class
at sun.security.util.SignatureFileVerifier.verifySection(SignatureFileVerifier.java:440)
at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:295)
at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:238)
at java.util.jar.JarVerifier.processEntry(JarVerifier.java:273)
at java.util.jar.JarVerifier.update(JarVerifier.java:228)
at java.util.jar.JarFile.initializeVerifier(JarFile.java:383)
at java.util.jar.JarFile.getInputStream(JarFile.java:450)
at sun.misc.JarIndex.getJarIndex(JarIndex.java:137)
at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:839)
at sun.misc.URLClassPath$JarLoader$1.run(URLClassPath.java:831)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath$JarLoader.ensureOpen(URLClassPath.java:830)
at sun.misc.URLClassPath$JarLoader.<init>(URLClassPath.java:803)
at sun.misc.URLClassPath$3.run(URLClassPath.java:530)
at sun.misc.URLClassPath$3.run(URLClassPath.java:520)
at java.security.AccessController.doPrivileged(Native Method)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:519)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:492)
at sun.misc.URLClassPath.getNextLoader(URLClassPath.java:457)
at sun.misc.URLClassPath.getResource(URLClassPath.java:211)
at java.net.URLClassLoader$1.run(URLClassLoader.java:365)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" [INFO] NETBEANS-ExecEvent:{"exc":{"msg":"Q29tbWFuZCBleGVjdXRpb24gZmFpbGVkLg=="},"mojo":{"impl":"org.codehaus.mojo.exec.ExecMojo","urls":["file:\/C:\/Users\/Kyalo\/.m2\/repository\/org\/codehaus\/mojo\/exec-maven-plugin\/1.2.1\/exec-maven-plugin-1.2.1.jar","file:\/C:\/Users\/Kyalo\/.m2\/repository\/org\/apache\/maven\/reporting\/maven-reporting-api\/2.0.6\/maven-reporting-api-2.0.6.jar","file:\/C:\/Users\/Kyalo\/.m2\/repository\/org\/apache\/maven\/doxia\/doxia-sink-api\/1.0-alpha-7\/doxia-sink-api-1.0-alpha-7.jar","file:\/C:\/Users\/Kyalo\/.m2\/repository\/commons-cli\/commons-cli\/1.0\/commons-cli-1.0.jar","file:\/C:\/Users\/Kyalo\/.m2\/repository\/org\/codehaus\/plexus\/plexus-interactivity-api\/1.0-alpha-4\/plexus-interactivity-api-1.0-alpha-4.jar","file:\/C:\/Users\/Kyalo\/.m2\/repository\/org\/codehaus\/plexus\/plexus-utils\/2.0.5\/plexus-utils-2.0.5.jar","file:\/C:\/Users\/Kyalo\/.m2\/repository\/org\/apache\/commons\/commons-exec\/1.1\/commons-exec-1.1.jar"],"goal":"exec","id":"org.codehaus.mojo:exec-maven-plugin:1.2.1","source":"CLI","execId":"default-cli"},"type":"MojoFailed"}
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 2:45.347s
Finished at: Wed Aug 03 10:00:58 EAT 2016
Final Memory: 23M/313M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project CoperativeERP: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
I will greatly appreciate if i could get any assistance
Nb: the error appears once i add the dependancy for dynamic reports.without it all is OK

Related

Can not resolve ${project.parent.version} to download dependency

i am using/tried with following versions:
Intellij 2022.3.3 and the prev. one.
Maven 3.8.5, 3.8.4, 3.8.1
I also tried following envs:
Maven-Tool integrated into IntelliJ
IntelliJ terminal
OS terminal
And i always get this error:
[WARNING] The POM for io.swagger:swagger-annotations:jar:${project.parent.version} is missing, no dependency information available
Could not find artifact io.swagger:swagger-annotations:pom:${project.parent.version} in mirror-maven.
[INFO]
[INFO] --- openapi-generator-maven-plugin:5.1.0:generate (generate) # XXX-parent-application ---
[WARNING] The POM for io.swagger.core.v3:swagger-annotations:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger.core.v3:swagger-models:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger.parser.v3:swagger-parser-v2-converter:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger.parser.v3:swagger-parser-v3:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for org.openapitools:openapi-generator-core:jar:${project.parent.version} is missing, no dependency information available
[INFO] --- swagger-maven-plugin:3.1.8:generate (default) # XXX-projectname ---
[WARNING] The POM for io.swagger:swagger-annotations:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger:swagger-core:jar:${project.parent.version} is missing, no dependency information available
[WARNING] The POM for io.swagger:swagger-jaxrs:jar:${project.parent.version} is missing, no dependency information available
URL_TO_MY_CENTRAL_REPO/io/swagger/core/v3/swagger-annotations/$%7Bproject.parent.version%7D/swagger-annotations-$%7Bproject.parent.version%7D.pom
I am the only one in my team who has this issue, we checked a lot of stuff:
delete maven-repo-folder
check maven-configuration in intellij and settings.xml
insert a static version (but it does not overwrite ${project.parent.version}
yes, it does exist on our artifactory-server
fresh pull from github
So, my question is, where can i find this used property, because i cant find it anywhere in the project.
Update:
added 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">
<parent>
<artifactId>PARENT</artifactId>
<groupId>GROUP_ID_APP</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<modules>
<module>application-a</module>
<module>application-b</module>
<module>application-c</module>
<module>application-d</module>
</modules>
<artifactId>PARENT-application</artifactId>
<packaging>pom</packaging>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<!--Properties for swagger generating-->
<swaggerJsonDir>${basedir}/target/generated</swaggerJsonDir>
<swaggerJsonVersion>${project.version}</swaggerJsonVersion>
<swaggerLocation>Override in child project</swaggerLocation>
<swaggerTitle>Override in child project</swaggerTitle>
<!--Override in child project with "compile"-->
<swaggerPhase>none</swaggerPhase>
<!--Properties for client generation-->
<client-generation-application-package>Override in child project</client-generation-application-package>
<sonar.exclusions>
**/foldername/**/*_generated/**/*.java
</sonar.exclusions>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- Testing -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- START: added this part below to check if this may solve my problem -->
<!-- <dependency>-->
<!-- <groupId>io.swagger</groupId>-->
<!-- <artifactId>swagger-core</artifactId>-->
<!-- <version>1.6.5</version>-->
<!-- </dependency>-->
<!-- 2.1.23 -->
<!-- https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-models -->
<!-- <dependency>-->
<!-- <groupId>io.swagger.core.v3</groupId>-->
<!-- <artifactId>swagger-models</artifactId>-->
<!-- <version>2.1.13</version>-->
<!-- </dependency>-->
<dependency>
<groupId>io.swagger.parser.v3</groupId>
<artifactId>swagger-parser</artifactId>
<version>2.0.30</version>
</dependency>
<dependency>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.4.0</version>
</dependency>
<!-- END: added this part above to check if this may solve my problem -->
</dependencies>
<build>
<plugins>
<!--Build executable jar from spring application.-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
<!--Generate swagger.json-->
<plugin>
<groupId>com.github.kongchen</groupId>
<artifactId>swagger-maven-plugin</artifactId>
<version>3.1.8</version>
<configuration>
<apiSources>
<apiSource>
<springmvc>true</springmvc>
<locations>
<location>${swaggerLocation}</location>
</locations>
<info>
<title>${swaggerTitle}</title>
<version>${swaggerJsonVersion}</version>
</info>
<outputFormats>json</outputFormats>
<swaggerDirectory>${swaggerJsonDir}</swaggerDirectory>
</apiSource>
</apiSources>
</configuration>
<executions>
<execution>
<phase>${swaggerPhase}</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>generate-application-b-client</id>
<properties>
<maven.test.skip>true</maven.test.skip>
<input>${project.basedir}/../application-b/target/generated/swagger.json</input>
<targetDirectory>${project.basedir}/target/application-b</targetDirectory>
<modelPackage>GROUP_ID_APP.${client-generation-application-package}.application_b_generated.model</modelPackage>
<apiPackage>GROUP_ID_APP.${client-generation-application-package}.application_b_generated.service.client</apiPackage>
<sourceDirectory>src/main/javapackagefoldername/${client-generation-application-package}</sourceDirectory>
<modelDirectory>${sourceDirectory}/application_b_generated/model</modelDirectory>
<apiDirectory>${sourceDirectory}/application_b_generated/service</apiDirectory>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.1.0</version>
<executions>
<execution>
<id>generate</id>
<phase>integration-test</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${input}</inputSpec>
<output>${targetDirectory}</output>
<skipValidateSpec>true</skipValidateSpec>
<generatorName>java</generatorName>
<modelPackage>${modelPackage}</modelPackage>
<apiPackage>${apiPackage}</apiPackage>
<typeMappings>
<typeMapping>OffsetDateTime=LocalDateTime</typeMapping>
</typeMappings>
<importMappings>
<importMapping>java.time.OffsetDateTime=java.time.LocalDateTime</importMapping>
</importMappings>
<configOptions>
<modelPackage>${modelPackage}</modelPackage>
<apiPackage>${apiPackage}</apiPackage>
<dateLibrary>java8</dateLibrary>
<java8>true</java8>
<library>resttemplate</library>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-models</id>
<phase>integration-test</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${modelDirectory}</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${targetDirectory}/${modelDirectory}</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-services</id>
<phase>integration-test</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${apiDirectory}</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${targetDirectory}/${apiDirectory}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>clean-old</id>
<phase>compile</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>${modelDirectory}</directory>
</fileset>
<fileset>
<directory>${apiDirectory}</directory>
</fileset>
</filesets>
</configuration>
</execution>
<execution>
<id>auto-clean</id>
<phase>integration-test</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>${targetDirectory}</directory>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>generate-application-a-client</id>
<properties>
<maven.test.skip>true</maven.test.skip>
<input>${project.basedir}/../application-a/target/generated/swagger.json</input>
<targetDirectory>${project.basedir}/target/application-a</targetDirectory>
<modelPackage>GROUP_ID_APP.${client-generation-application-package}.application_a_generated.model</modelPackage>
<apiPackage>GROUP_ID_APP.${client-generation-application-package}.application_a_generated.service.client</apiPackage>
<sourceDirectory>src/main/javapackagefoldername/${client-generation-application-package}</sourceDirectory>
<modelDirectory>${sourceDirectory}/application_a_generated/model</modelDirectory>
<apiDirectory>${sourceDirectory}/application_a_generated/service</apiDirectory>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<version>5.1.0</version>
<executions>
<execution>
<id>generate</id>
<phase>integration-test</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${input}</inputSpec>
<output>${targetDirectory}</output>
<skipValidateSpec>true</skipValidateSpec>
<generatorName>java</generatorName>
<modelPackage>${modelPackage}</modelPackage>
<apiPackage>${apiPackage}</apiPackage>
<typeMappings>
<typeMapping>OffsetDateTime=LocalDateTime</typeMapping>
</typeMappings>
<importMappings>
<importMapping>java.time.OffsetDateTime=java.time.LocalDateTime</importMapping>
</importMappings>
<configOptions>
<modelPackage>${modelPackage}</modelPackage>
<apiPackage>${apiPackage}</apiPackage>
<dateLibrary>java8</dateLibrary>
<java8>true</java8>
<library>resttemplate</library>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>copy-models</id>
<phase>integration-test</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${modelDirectory}</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${targetDirectory}/${modelDirectory}</directory>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-services</id>
<phase>integration-test</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${apiDirectory}</outputDirectory>
<overwrite>true</overwrite>
<resources>
<resource>
<directory>${targetDirectory}/${apiDirectory}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>clean-old</id>
<phase>compile</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>${modelDirectory}</directory>
</fileset>
<fileset>
<directory>${apiDirectory}</directory>
</fileset>
</filesets>
</configuration>
</execution>
<execution>
<id>auto-clean</id>
<phase>integration-test</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>${targetDirectory}</directory>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Maven often doesn't resolve version number for transitive dependencies - "${project.version}"
ill post my solution there.

Can't build working Java app with gRPC, Protobuf and BoringSSL to JAR using Maven

I have problem with building my Java app to jar file using Maven.
Application is using gRPC and Protobuf.
When I start my app in IntelliJ everything work just fine, problem is when I want to build jar with Maven... I don't have much experience with creating pom files.
I tried to find some solution but nothing works and I ended up with pom.xml as below:
[...]
<properties>
<grpc.version>1.17.1</grpc.version>
<protoc.version>3.5.1-1</protoc.version>
<netty.tcnative.version>2.0.13.Final</netty.tcnative.version>
[...]
</properties>
<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${netty.tcnative.version}</version>
<scope>runtime</scope>
</dependency>
[...]
</dependencies>
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.5.0.Final</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}
</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
<executions>
<execution>
<id>enforce</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireUpperBoundDeps/>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>pl.test.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
And this is the exception when I try to start gRPC server with SSL context:
Exception in thread "Thread-2" java.lang.UnsatisfiedLinkError: failed to load the required native library
at io.netty.handler.ssl.OpenSsl.ensureAvailability(OpenSsl.java:346)
at io.netty.handler.ssl.ReferenceCountedOpenSslContext.<init>(ReferenceCountedOpenSslContext.java:202)
at io.netty.handler.ssl.OpenSslContext.<init>(OpenSslContext.java:43)
at io.netty.handler.ssl.OpenSslServerContext.<init>(OpenSslServerContext.java:347)
at io.netty.handler.ssl.OpenSslServerContext.<init>(OpenSslServerContext.java:335)
at io.netty.handler.ssl.SslContext.newServerContextInternal(SslContext.java:422)
at io.netty.handler.ssl.SslContextBuilder.build(SslContextBuilder.java:447)
at pl.test.grpc.GrpcServer.start(GrpcServer.java:80)
at pl.test.app.Main.lambda$new$0(Main.java:80)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: io.netty.internal.tcnative.SSL
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
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)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:85)
at io.grpc.netty.GrpcSslContexts.configure(GrpcSslContexts.java:194)
at pl.test.grpc.GrpcServer.getSslContextBuilder(GrpcServer.java:72)
... 3 more
I'm building it using command:
mvn clean compile assembly:single
Can someone help with creating working pom file? The result doesn't have to be single jar file, it might be multiple jars.
I found solution, maybe it will help someone deal with the same problem.
We have to add dependency io.netty.netty-handler and set compatible versions of io.grpc.grpc-netty, io.netty.netty-tcnative-boringssl-static and io.netty.netty-handler as it is described in table over here https://github.com/grpc/grpc-java/blob/master/SECURITY.md#netty.
Here's my current pom.xml
[...]
<properties>
<grpc.version>1.17.1</grpc.version>
<protoc.version>3.5.1-1</protoc.version>
<netty.tcnative.version>2.0.17.Final</netty.tcnative.version>
<netty.handler.version>4.1.30.Final</netty.handler.version>
[...]
</properties>
<dependencies>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>${grpc.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>${netty.handler.version}</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>${netty.tcnative.version}</version>
<scope>runtime</scope>
</dependency>
[...]
</dependencies>
<build>
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.5.0.Final</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.1</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}
</protocArtifact>
<pluginId>grpc-java</pluginId>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
</pluginArtifact>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>compile-custom</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.4.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
<executions>
<execution>
<id>enforce</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireUpperBoundDeps/>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>pl.test.Main</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
And now I can build jar using command:
mvn clean compile assembly:assembly

Maven compile error ProjectBuildingException

I'm trying to compile with maven a specific snapshot of Apache log4j.
I obtain this error:
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
org.apache.maven.project.ProjectBuildingException: Some problems were encountered while processing the POMs:
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-resources-plugin is missing. # line 89, column 15
[ERROR] 'build.plugins.plugin[org.apache.maven.plugins:maven-antrun-plugin].dependencies.dependency.scope' for junit:junit:jar must be one of [compile, runtime, system] but is 'test'. # line 321, column 20
at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:416)
at org.apache.maven.DefaultMaven.collectProjects(DefaultMaven.java:663)
at org.apache.maven.DefaultMaven.getProjectsForMavenReactor(DefaultMaven.java:654)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:243)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[ERROR]
[ERROR] The project log4j:log4j:1.2.17-SNAPSHOT (/scratch/test/log4j/code/pom.xml) has 1 error
[ERROR] 'build.plugins.plugin[org.apache.maven.plugins:maven-antrun-plugin].dependencies.dependency.scope' for junit:junit:jar must be one of [compile, runtime, system] but is 'test'. # line 321, column 20
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
This is the POM file:
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://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.
-->
<!--
Usage notes:
To build NTEventLogAppender.dll using MinGW, place mingw\bin on path for Windows or install mingw
package on other platforms. Build will execute gcc and windres on Windows and
i586-mingw32msvc-gcc and i586-mingw32msvc-windres on other platforms.
To build NTEventLogAppender.dll using Microsoft tools, run the appropriate vcvars for the
target platform and specify -Dntdll_target=msbuild on the mvn command line.
-->
<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>log4j</groupId>
<artifactId>log4j</artifactId>
<packaging>bundle</packaging>
<name>Apache Log4j</name>
<version>1.2.17-SNAPSHOT</version>
<description>Apache Log4j 1.2</description>
<url>http://logging.apache.org/log4j/1.2/</url>
<issueManagement>
<system>Bugzilla</system>
<url>http://issues.apache.org/bugzilla/</url>
</issueManagement>
<ciManagement>
<system>Gump</system>
<url>http://vmgump.apache.org/gump/public/logging-log4j-12/logging-log4j-12/index.html</url>
</ciManagement>
<inceptionYear>1999</inceptionYear>
<mailingLists>
<mailingList>
<name>log4j-user</name>
<subscribe>log4j-user-subscribe#logging.apache.org</subscribe>
<unsubscribe>log4j-user-unsubscribe#logging.apache.org</unsubscribe>
<post>log4j-user#logging.apache.org</post>
<archive>http://mail-archives.apache.org/mod_mbox/logging-log4j-user/</archive>
<otherArchives>
<otherArchive>http://marc.info/?l=log4j-user</otherArchive>
<otherArchive>http://dir.gmane.org/gmane.comp.jakarta.log4j.user</otherArchive>
</otherArchives>
</mailingList>
<mailingList>
<name>log4j-dev</name>
<subscribe>log4j-dev-subscribe#logging.apache.org</subscribe>
<unsubscribe>log4j-dev-unsubscribe#logging.apache.org</unsubscribe>
<post>log4j-dev#logging.apache.org</post>
<archive>http://mail-archives.apache.org/mod_mbox/logging-log4j-dev/</archive>
<otherArchives>
<otherArchive>http://marc.info/?l=log4j-dev</otherArchive>
<otherArchive>http://dir.gmane.org/gmane.comp.jakarta.log4j.devel</otherArchive>
</otherArchives>
</mailingList>
</mailingLists>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<connection>scm:svn:http://svn.apache.org/repos/asf/logging/log4j/trunk</connection>
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/logging/log4j/trunk</developerConnection>
<url>http://svn.apache.org/viewvc/logging/log4j/trunk</url>
</scm>
<organization>
<name>Apache Software Foundation</name>
<url>http://www.apache.org</url>
</organization>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.5</version>
<configuration>
<workingDirectory>tests</workingDirectory>
<reportFormat>plain</reportFormat>
<forkMode>pertest</forkMode>
<skip>true</skip>
<includes>
<include>org/apache/log4j/LevelTest.java</include>
<include>org/apache/log4j/PriorityTest.java</include>
<include>org/apache/log4j/CategoryTest.java</include>
<include>org/apache/log4j/FileAppenderTest.java</include>
<include>org/apache/log4j/LogManagerTest.java</include>
<include>org/apache/log4j/helpers.LogLogTest.java</include>
<include>org/apache/log4j/LayoutTest.java</include>
<include>org/apache/log4j/helpers.DateLayoutTest.java</include>
<include>org/apache/log4j/TTCCLayoutTest.java</include>
<include>org/apache/log4j/xml.XMLLayoutTest.java</include>
<include>org/apache/log4j/HTMLLayoutTest.java</include>
<include>org/apache/log4j/PatternLayoutTest.java</include>
<include>org/apache/log4j/spi.LoggingEventTest.java</include>
<include>org/apache/log4j/spi.ThrowableInformationTest.java</include>
<include>org/apache/log4j/spi.LocationInfoTest.java</include>
<include>org/apache/log4j/PropertyConfiguratorTest.java</include>
<include>org/apache/log4j/MinimumTestCase.java</include>
<include>org/apache/log4j/LoggerTestCase.java</include>
<include>org/apache/log4j/PatternLayoutTestCase.java</include>
<include>org/apache/log4j/HierarchyThresholdTestCase.java</include>
<include>org/apache/log4j/xml/DOMTestCase.java</include>
<include>org/apache/log4j/xml/CustomLevelTestCase.java</include>
<include>org/apache/log4j/customLogger/XLoggerTestCase.java</include>
<!-- DefaultInit -->
<!-- SocketServer -->
<include>org/apache/log4j/xml/XMLLayoutTestCase.java</include>
<include>org/apache/log4j/xml/AsyncAppenderTestCase.java</include>
<include>org/apache/log4j/varia/LevelMatchFilterTestCase.java</include>
<!-- ErrorHandlerTestCase is not run in Ant build either
<include>org/apache/log4j/varia/ErrorHandlerTestCase.java</include>
-->
<!-- include>org/apache/log4j/helpers/OptionConverterTestCase.java</include -->
<include>org/apache/log4j/helpers/BoundedFIFOTestCase.java</include>
<include>org/apache/log4j/helpers/CyclicBufferTestCase.java</include>
<include>org/apache/log4j/helpers/PatternParserTestCase.java</include>
<include>org/apache/log4j/or/ORTestCase.java</include>
<include>org/apache/log4j/DRFATestCase.java</include>
<include>org/apache/log4j/RFATestCase.java</include>
<include>org/apache/log4j/varia/ERFATestCase.java</include>
<include>org/apache/log4j/net/SyslogAppenderTest</include>
<include>org/apache/log4j/nt/NTEventLogAppenderTest</include>
<include>org/apache/log4j/net/SocketAppenderTest</include>
</includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
<source>1.3</source>
<target>1.1</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3</version>
<configuration>
<archive>
<manifestSections>
<manifestSection>
<name>org.apache.log4j</name>
<manifestEntries>
<DynamicImport-Package>*</DynamicImport-Package>
<Implementation-Title>log4j</Implementation-Title>
<Implementation-Version>${project.version}</Implementation-Version>
<Implementation-Vendor>"Apache Software Foundation"</Implementation-Vendor>
</manifestEntries>
</manifestSection>
</manifestSections>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.2</version>
<executions>
<!-- generate NTEventLogAppender.dll -->
<execution>
<phase>process-classes</phase>
<id>ntdll</id>
<configuration>
<tasks>
<ant antfile="src/ntdll/build.xml" target="${ntdll_target}">
<property name="target.dir" location="target" />
<property name="classes.dir" location="target/classes" />
<property name="src.dir" location="src/ntdll" />
<property name="jni.include.dir" location="${java.home}/../include" />
</ant>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<!-- create tests/output prior to test run -->
<execution>
<phase>test-compile</phase>
<id>mkdir_tests_output</id>
<configuration>
<tasks>
<mkdir dir="tests/output" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<phase>clean</phase>
<id>rmdir_tests_output</id>
<configuration>
<tasks>
<delete dir="tests/output" />
<delete dir="tests/classes" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<phase>test</phase>
<id>runAll</id>
<configuration>
<tasks>
<ant dir="tests" target="runAll">
<property name="m2_repo" location="${m2_repo}" />
<property name="log4j.jar" location="target/classes" />
<property name="project.lib.home" location="target" />
</ant>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<!-- release builds will put SVN tags into the SCM page, this changes it back to trunk -->
<execution>
<phase>site</phase>
<id>untag-site</id>
<configuration>
<tasks>
<taskdef name="replaceregexp" classname="org.apache.tools.ant.taskdefs.optional.ReplaceRegExp" />
<replaceregexp file="target/site/source-repository.html" match="/tags/[^ "'<]*" replace="/trunk" flags="g" />
<replaceregexp match="-- Generated by (.*) on .*--" replace="-- Generated by \1 --" flags="g">
<fileset dir="target/site/apidocs" includes="**/*.html" />
</replaceregexp>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<phase>post-site</phase>
<id>post-site</id>
<configuration>
<tasks>
<ant target="post-site" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<phase>site-deploy</phase>
<id>site-deploy</id>
<configuration>
<tasks>
<ant target="site-deploy" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
<execution>
<id>javadoc.resources</id>
<phase>generate-sources</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy todir="${project.build.directory}/apidocs/META-INF">
<fileset dir="${basedir}">
<include name="LICENSE" />
<include name="NOTICE" />
</fileset>
</copy>
</tasks>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
<version>1.0b2</version>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant-junit</artifactId>
<version>1.6.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>sun.jdk</groupId>
<artifactId>tools</artifactId>
<version>1.4.2</version>
<scope>system</scope>
<systemPath>${tools.jar}</systemPath>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<configuration>
<descriptors>
<descriptor>src/assembly/bin.xml</descriptor>
</descriptors>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<goals>
<goal>assembly</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<docfilessubdirs>true</docfilessubdirs>
<excludedocfilessubdir>.svn</excludedocfilessubdir>
<encoding>UTF-8</encoding>
<docEncoding>UTF-8</docEncoding>
</configuration>
<executions>
<execution>
<goals>
<goal>jar</goal>
<goal>javadoc</goal>
</goals>
</execution>
<execution>
<id>site</id>
<phase>pre-site</phase>
<goals>
<goal>javadoc</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-9</version>
<!--
Bug MRELEASE-273 has been throwing NPE during release:perform,
typically after deploy so this places it last.
-->
<configuration>
<goals>package site-deploy assembly:attached deploy</goals>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.1</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!--
clirr:check will fail with NullPointerException
due to missing javax.jms.MessageListener,
however it will trigger download of supporting components
which can allow "ant clirr" to succeed.
Could possibly run on a JavaEE platform.
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>clirr-maven-plugin</artifactId>
<version>2.2.2</version>
<configuration>
<comparisonVersion>1.2.15</comparisonVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rat-maven-plugin</artifactId>
<version>1.0-alpha-3</version>
<configuration>
<excludes>
<exclude>tests/witness/**</exclude>
<exclude>tests/output/**</exclude>
<exclude>tests/classes/**</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.1.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<!-- omit chainsaw and LF5 -->
<Export-Package>!org.apache.log4j.lf5.*,
!org.apache.log4j.chainsaw.*,
org.apache.log4j.*;version=1.2.17;-noimport:=true</Export-Package>
<!-- all other potential imports are covered by DynamicImport-Package earlier -->
<Import-Package>!javax.swing.*,
!com.ibm.uvm.tools.*,
!com.sun.jdmk.comm.*,
javax.jmdns.*;resolution:=optional,
javax.jms.*;resolution:=optional,
javax.mail.*;resolution:=optional,
*</Import-Package>
<Bundle-DocURL>http://logging.apache.org/log4j/1.2</Bundle-DocURL>
</instructions>
</configuration>
</plugin>
</plugins>
<testSourceDirectory>tests/src/java</testSourceDirectory>
<testResources>
<testResource>
<directory>tests/resources</directory>
</testResource>
</testResources>
</build>
<profiles>
<profile>
<id>mac</id>
<activation>
<os>
<family>mac</family>
</os>
</activation>
<properties>
<tools.jar>${java.home}/../Classes/classes.jar</tools.jar>
<m2_repo>${user.home}/.m2/repository</m2_repo>
<ntdll_target>build</ntdll_target>
</properties>
</profile>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<tools.jar>${java.home}/../lib/tools.jar</tools.jar>
<m2_repo>${user.home}/.m2/repository</m2_repo>
<ntdll_target>build</ntdll_target>
</properties>
</profile>
</profiles>
<repositories>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.3</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>javaee-api</artifactId>
<version>5.0-2</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<!-- the following dependency is not needed on JDK 1.5 and higher
<dependency>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
<version>1.2.1</version>
<optional>true</optional>
</dependency>
-->
<dependency>
<groupId>oro</groupId>
<artifactId>oro</artifactId>
<version>2.0.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jms_1.1_spec</artifactId>
<version>1.0</version>
<optional>true</optional>
</dependency>
</dependencies>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.1.2</version>
<reportSets>
<reportSet>
<reports>
<report>scm</report>
<report>dependencies</report>
<report>cim</report>
<report>issue-tracking</report>
<report>mailing-list</report>
<report>license</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<artifactId>maven-changes-plugin</artifactId>
<version>2.3</version>
<reportSets>
<reportSet>
<reports>
<report>changes-report</report>
</reports>
</reportSet>
</reportSets>
<configuration>
<issueLinkTemplate>%URL%/show_bug.cgi?id=%ISSUE%</issueLinkTemplate>
</configuration>
</plugin>
</plugins>
</reporting>
<distributionManagement>
<repository>
<id>logging.repo</id>
<url>scp://people.apache.org/www/people.apache.org/builds/logging/repo/</url>
</repository>
<site>
<id>logging.site</id>
<url>scp://localhost/${user.dir}/target/site-deploy</url>
</site>
</distributionManagement>
</project>
What do you think is the cause of the problem? Is the pom file malformed? Are there some unresolved dependencies?
I'm using Apache Maven 3.0.5.
Thanks.
The log4j version you are running was designed with maven2.
Try to run it with maven2.
Scope parameter for junit dependency can only have values - compile, runtime, system.
This indicates to Maven that the dependency will be provided at runtime/compile/system by its container or JDK.
Try removing scope or give valid value.

Cannot build Maven Project

I have this maven configuration which I want to use on different operating systems:
<?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.dx57dc</groupId>
<artifactId>DX57DC</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>DX57DC</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mainClass>com.dx57dc.MainApp</mainClass>
</properties>
<profiles>
<profile>
<activation>
<os>
<name>Windows XP</name>
<family>Windows</family>
<arch>x86</arch>
<version>5.1.2600</version>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<excludeScope>system</excludeScope>
<excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/../bin/javafxpackager</executable>
<arguments>
<argument>-createjar</argument>
<argument>-nocss2bin</argument>
<argument>-appclass</argument>
<argument>${mainClass}</argument>
<argument>-srcdir</argument>
<argument>${project.build.directory}/classes</argument>
<argument>-outdir</argument>
<argument>${project.build.directory}</argument>
<argument>-outfile</argument>
<argument>${project.build.finalName}.jar</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<bootclasspath>${sun.boot.class.path}${path.separator}${java.home}/lib/jfxrt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<activation>
<os>
<name>Linux</name>
<family>Linux</family>
<arch>x86</arch>
<!-- <version>5.1.2600</version> -->
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<excludeScope>system</excludeScope>
<excludeGroupIds>junit,org.mockito,org.hamcrest</excludeGroupIds>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<id>unpack-dependencies</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${java.home}/../bin/javafxpackager</executable>
<arguments>
<argument>-createjar</argument>
<argument>-nocss2bin</argument>
<argument>-appclass</argument>
<argument>${mainClass}</argument>
<argument>-srcdir</argument>
<argument>${project.build.directory}/classes</argument>
<argument>-outdir</argument>
<argument>${project.build.directory}</argument>
<argument>-outfile</argument>
<argument>${project.build.finalName}.jar</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArguments>
<bootclasspath>/opt/java/jre/lib/ext/jfxrt.jar</bootclasspath>
</compilerArguments>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
I get this warning message:
--- exec-maven-plugin:1.2.1:exec (default-cli) # DX57DC ---
Error: Unable to access jarfile D:\Documents
Can you tell me what is the proper way to configure this POM file?
P.S After I added "" with them or without I get this error on Windows:
[exec:exec]
java.lang.NoClassDefFoundError: javafx/application/Application
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
Caused by: java.lang.ClassNotFoundException: javafx.application.Application
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 13 more
Exception in thread "main" [INFO] ------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 1.000s
Finished at: Fri Aug 02 14:09:35 PDT 2013
Final Memory: 6M/15M
------------------------------------------------------------------------
Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project DX57DC: Command execution failed. Process exited with an error: 1 (Exit value: 1) -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I think its because some of the arguments sent to exec-maven-plugin contains spaces.
In your case it looks like ${project.build.directory} or some other variable resolves to C:\Documents and Settings\something.
When you are passing this:
<argument>-srcdir</argument>
<argument>${project.build.directory}/classes</argument>
It will resolve to: -srcdir=C:\Documents and Settings\something/classes.
When it should have been something like: -srcdir="C:\Documents and Settings\something/classes" with "".
In your exec-plugin configuration, put "" around all your properties <argument> tags (the ones that contain $ in them)
like this
<arguments>
<argument>-createjar</argument>
<argument>-nocss2bin</argument>
<argument>-appclass</argument>
<argument>"${mainClass}"</argument>
....
</arguments>

Eclipselink 2.5 Metamodel Generation using Maven

I would like to know how to generate static metamodels using Maven and Eclipselink 2.5. It worked fine by adding this lines to pom.xml when running Eclipselink 2.4.
// Generate meta model for eclipselink 2.4 (does not work for 2.5)
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>1.3.1</version>
<executions>
<execution>
<id>process</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<compilerArguments>-Aeclipselink.persistencexml=src/main/resources/META-INF/persistence.xml</compilerArguments>
<processors>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
</processors>
<outputDirectory>${project.build.directory}/generated-sources/meta-model</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
But it seems like something has changed since 2.4 cause I get following error:
[INFO] javac option: -proc:only
[INFO] javac option: -Aeclipselink.persistencexml=src/main/resources/META-INF/persistence.xml
[INFO] javac option: -processor
[INFO] javac option: org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
[INFO] javac option: -s
[INFO] javac option: /home/asdf/target/generated-sources/meta-model
[INFO] diagnostic error: Annotation processor 'org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor' not found
[INFO] diagnostic warning: Annotation processing without compilation requested but no processors were found.
[ERROR] execute error
java.lang.Exception: error during compilation
at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.executeWithExceptionsHandled(AbstractAnnotationProcessorMojo.java:183)
at org.bsc.maven.plugin.processor.AbstractAnnotationProcessorMojo.execute(AbstractAnnotationProcessorMojo.java:96)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Can you guys out there help me? =)
B.R
It appears that they've moved the CanonicalModelProcessor class to it's own maven artifact:
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>2.5.0</version>
</dependency>
The following maven-processor-plugin configuration works for me:
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<version>2.2.4</version>
<executions>
<execution>
<id>eclipselink-jpa-metamodel</id>
<goals>
<goal>process</goal>
</goals>
<phase>generate-sources</phase>
<configuration>
<processors>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor>
</processors>
<outputDirectory>${project.build.directory}/generated-sources/meta-model</outputDirectory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>2.5.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</plugin>
Very important note: the metamodel is generated only if the entities are declared in the persistence unit. It doesn't work with discovered entities.
For me using maven-compiler-plugin from org.apache.maven.plugins resulted in MojoFailureException when using other command than mvn clean install.
The tested the solutions with org.eclipse.persistence.jpa.modelgen.processor 2.6.0.
The configuration in both cases is quite similar.
The main issue which I had with org.bsc.maven was to properly configure the compilerArguments parts. That is why I post (both) the solutions below.
The documentation is available: HERE.
Solution using maven-compiler-plugin from org.bsc.maven
For me this one worked better
<plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<executions>
<execution>
<id>eclipselink-jpa-metamodel</id>
<goals>
<goal>process</goal>
</goals>
<configuration>
<compilerArguments>
-Aeclipselink.persistencexml=${basedir}/src/main/resources/META-INF/persistence.xml
</compilerArguments>
<processors>
<processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
</processor>
</processors>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>${eclipselink.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</plugin>
Solution using maven-compiler-plugin from org.apache.maven.plugins
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>${eclipselink.version}</version>
<scope>compile</scope>
</dependency>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<arg>-Aeclipselink.persistencexml=src/main/resources/META-INF/persistence.xml</arg>
</compilerArgs>
</configuration>
</plugin>
To make configuration a lot simpler I would recommend you test: https://github.com/ethlo/eclipselink-maven-plugin. You will not even be required to keep an updated persistence.xml file.
<plugin>
<groupId>com.ethlo.persistence.tools</groupId>
<artifactId>eclipselink-maven-plugin</artifactId>
<version>[version]</version>
<executions>
<execution>
<id>weave</id>
<phase>process-classes</phase>
<goals>
<goal>weave</goal>
</goals>
</execution>
<execution>
<id>modelgen</id>
<phase>generate-sources</phase>
<goals>
<goal>modelgen</goal>
</goals>
</execution>
</executions>
</plugin>
Note: I'm the author of the plugin.
2017 UPDATE:
Main answer to this question is now outdated.
You now need to perform the following steps in order to have it work.
1) Import the required dependency:
<!-- https://mvnrepository.com/artifact/org.eclipse.persistence/org.eclipse.persistence.jpa.modelgen.processor -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>2.5.2</version>
<scope>compile</scope>
</dependency>
2) Specify persistence.xml location (this is a workaround for an EL bug. Please note that your path may vary from the one specified in this example):
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<executions>
<execution>
<id>default-compile</id>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
[...]
</executions>
<configuration>
<source>1.7</source>
<target>1.7</target>
<compilerArgs>
<arg>-Aeclipselink.persistencexml=src/main/resources/META-INF/persistence.xml</arg>
</compilerArgs>
</configuration>
</plugins>
[...]
</pluginManagement>
[...]
</build>
3) Finally refer to the following item in order to trigger the execution with Maven's new Lifecycle Mappings:
Usage of maven Build Helper Maven Plugin
you're likely to get the following error:
java.lang.RuntimeException: java.lang.SecurityException: class "org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProperties"'s signer information does not match signer information of other classes in the same package
Because of the unresolved bug compilation is broken, modelgen jar is signed in maven repository, the version must be set to 2.5.0-SNAPSHOT for now.
This is what I used
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>2.5.1</version>
<scope>provided</scope>
</dependency>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
<executions>
<execution>
<id>generate-entity-metamodel</id>
<phase>generate-sources</phase>
<goals>
<goal>
compile
</goal>
</goals>
<configuration>
<source>1.6</source>
<target>1.6</target>
<optimize>true</optimize>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
<proc>only</proc>
<!--<compilerArgument>-Aeclipselink.metamodel=true</compilerArgument>
<generatedSourcesDirectory>${basedir}/src/main/java</generatedSourcesDirectory>-->
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>add-modelgen-generated-sources-directory</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${project.build.directory}/target/generated-sources/annotations</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
the add-sources part is for netbeans 8 to understand it to put it in classpath
:)

Resources