I am new to maven and java. I am working on a Java/DROOLS project. I was experiencing errors which seemed to be fixed with the next version of DROOLS. I changed the version in my pom.xml and then did mvn package.
The files were downloaded but every line of code that references DROOLS throws a compile error of package org.drools does not exist.
[ERROR] /C:/Dev/src/main/java/com/company/project/drools/client/DroolsRulesRunner.java:[11,18] package org.drools does not exist
[ERROR] /C:/Dev/src/main/java/com/company/project/drools/client/DroolsRulesRunner.java:[12,29] package org.drools.definition does not exist
Any help would be greatly appreciated.
Edit
Here is my pom.xml.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.bericotechnologies</groupId>
<artifactId>sbt-rules</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>my-app</name>
<url>http://maven.apache.org</url>
<properties>
<drools.version>7.6.0.Final</drools.version>
<jbpm5.version>7.6.0.Final</jbpm5.version>
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.12</version>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-flow</artifactId>
<version>${jbpm5.version}</version>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-bpmn2</artifactId>
<version>${jbpm5.version}</version>
</dependency>
<dependency>
<groupId>org.jbpm</groupId>
<artifactId>jbpm-flow-builder</artifactId>
<version>${jbpm5.version}</version>
</dependency>
<dependency>
<groupId>pl.maciejwalkowiak</groupId>
<artifactId>junit-drools</artifactId>
<version>1.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
<version>${drools.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.core</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.rzo.yajsw</groupId>
<artifactId>wrapper</artifactId>
<version>11.11</version>
</dependency>
<dependency>
<groupId>org.rzo.yajsw</groupId>
<artifactId>wrapperApp</artifactId>
<version>11.11</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>jboss</id>
<name>jboss</name>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>maciejwalkowiak.pl</id>
<url>https://github.com/maciejwalkowiak/maven-repo/raw/releases/</url>
</repository>
</repositories>
<build>
<resources>
<resource>
<directory>src/main/rules</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>com.google.code.sortpom</groupId>
<artifactId>maven-sortpom-plugin</artifactId>
<version>2.3.0</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>sort</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>com.berico.psip.run.RunDroolsService</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
The only thing that I changed is
<properties>
<drools.version>5.6.0.Final</drools.version>
<jbpm5.version>5.5.0.Final</jbpm5.version>
</properties>
to
<properties>
<drools.version>7.6.0.Final</drools.version>
<jbpm5.version>7.6.0.Final</jbpm5.version>
</properties>
If I change it back everything works fine. I can see the 7.6.0.Final jars in the repository.
You have broken imports and you have to fix them.
There's changes in the package structure of Drools between versions 5.6.0.Final and 7.6.0.Final. The package "definitions" is now under org.drools.core.definitions (v7.6.0.Final) and not under org.drools.definitions (5.6.0.Final).
You need to remove all imports beginning with org.drools in your classes and re-import the missing Drools classes again with the new package locations - those from version 7.6.0.Final.
Related
I have the following 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
https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.cnt.orchtn</groupId>
<artifactId>orchtn-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../../orchtn-parent/pom.xml</relativePath>
</parent>
<groupId>com.dsfsdaf.orchtn</groupId>
<artifactId>orchen-con-service</artifactId>
<version>1.0-RELEASE</version>
<name>OrchServi</name>
<description>Orch</description>
<packaging>jar</packaging>
<properties>
<java.version>11</java.version>
<camel.version>3.1.0</camel.version>
<jackson.version>1.9.13</jackson.version>
<kafka.version>2.6.0</kafka.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-kafka-starter</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http</artifactId>
<version>3.1.0</version>
<!-- use the same version as your Camel core version -->
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<!-- <version>2.10.0</version> -->
<version>2.11.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20200518</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<!-- This dependency is for WebClient implementation -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<version>2.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.bazaarvoice.jolt</groupId>
<artifactId>jolt-core</artifactId>
<version>0.0.17</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.11.3</version>
</dependency>
<dependency>
<groupId>com.bazaarvoice.jolt</groupId>
<artifactId>json-utils</artifactId>
<version>0.0.10</version>
</dependency>
<!-- <dependency>
<groupId>org.jfrog.buildinfo</groupId>
<artifactId>artifactory-maven-plugin</artifactId>
<version>3.0.0</version>
</dependency>
-->
</dependencies>
<repositories>
<repository>
<id>cnc-clg-srd-cbf-artifactory--cnc-clg-srd-cbf-artifactory</id>
<name>cnc-clg-srd-cbf-artifactory--cnc-clg-srd-cbf-artifactory</name>
<url>https://cnc-clg-srd-cbf-artifactory-255474220078.d.codeartifact.us-east
1.amazonaws.com/maven/cnc-clg-srd-cbf-artifactory/</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>Maven-Artifactory-Plugin</id>
<url>https://jcenter.bintray.com</url>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>cnc-clng-srd-cbf-artifactory--cnc-clng-srd-cbf-artifactory</id>
<name>cnc-clng-srd-cbf-artifactory--cnc-clng-srd-cbf-artifactory</name>
<url>https://cnc-clng-srd-cbf-artifactory-255474220078.d.codeartifact.us-east
1.amazonaws.com/maven/cnc-clng-srd-cbf-artifactory/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<goals>
<goal>jar</goal>
</goals>
</plugin>
<!-- <plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin> -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
</plugins>
</build>
</project>
I have the following parent pom file:
<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.cnt.orctr</groupId>
<artifactId>orctr-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<description>Orch Parent</description>
<packaging>pom</packaging>
<url>http://maven.apache.org</url>
<properties>
<java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<version>2.2.6.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
<version>5.7.0</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<version>2.3.4.RELEASE</version>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>cnc-clng-srd-cbf-artifactory--cnc-clng-srd-cbf-artifactory</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>cnc-clng-srd-cbf-artifactory--cnc-clng-srd-cbf-artifactory</id>
<name>cnc-clng-srd-cbf-artifactory--cnc-clng-srd-cbf-artifactory</name>
<url>https://cnc-clng-srd-cbf-artifactory-255474220078.d.codeartifact.us-east
1.amazonaws.com/maven/cnc-clng-srd-cbf-artifactory/</url>
</repository>
</profile>
</profiles>
<pluginRepositories>
<pluginRepository>
<id>Maven-Artifactory-Plugin</id>
<url>https://jcenter.bintray.com</url>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>cnc-clng-srd-cbf-artifactory--cnc-clng-srd-cbf-artifactory</id>
<name>cnc-clng-srd-cbf-artifactory--cnc-clng-srd-cbf-artifactory</name>
<url>https://cnc-clng-srd-cbf-artifactory-255474220078.d.codeartifact.us-east
1.amazonaws.com/maven/cnc-clng-srd-cbf-artifactory/</url>
</repository>
</distributionManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
</plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
</plugin>
<plugin>
<groupId>org.jfrog.buildinfo</groupId>
<artifactId>artifactory-maven-plugin</artifactId>
<version>3.0.0</version>
<inherited>false</inherited>
<executions>
<execution>
<id>build-info</id>
<goals>
<goal>publish</goal>
</goals>
<configuration>
<artifactory>
<includeEnvVars>true</includeEnvVars>
<envVarsExcludePatterns>*password*,*secret*,*key*,*token*,*passphrase*</envVarsExcludePatterns>
<timeoutSec>60</timeoutSec>
</artifactory>
<publisher>
<contextUrl>https://cnc-clng-srd-cbf-artifactory-255474220078.d.codeartifact.us-east-1.amazonaws.com/maven/cnc-clng-srd-cbf-artifactory/</contextUrl>
<username>aws</username>
<password>${env.CODEARTIFACT_AUTH_TOKEN}</password>
<repoKey>libs-release-local</repoKey>
<snapshotRepoKey>libs-snapshot-local</snapshotRepoKey>
</publisher>
<!-- <buildInfo> <buildName>centene-framework</buildName> <buildNumber>${buildnumber}</buildNumber>
<buildUrl>http://build-url.org</buildUrl> </buildInfo> -->
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
I am able to compile and deploy the parent project into the repository. The problem is with the child project which I am not able to compile, it is throwing build failures. It is not able to resolve any dependencies which are referenced in the parent project.
Could anyone let me know what I am missing and how I can reference the parent pom in the child pom, and have all the dependencies resolved in the child project.
Note: I have seen all the child pom being referenced in many web sites. I dont see any difference in any way that I am doing it. Maybe noticing something here. Could some one point out...
I'm making some minecraft plugin that hooks into the JDA Discord API using Maven. The dependency loads but the class doesn't when I load it.
I've tried to make a separate project using default package and it works.
Now I moved the dependency from that bot project to my minecraft project, and the dependency successfully loads in the eclipse. However, when I ran my plugin, it shows me an error that the class doesn't exist.
java.lang.NoClassDefFoundError: net/dv8tion/jda/core/hooks/ListenerAdapte
<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.gmail.JyckoSianjaya.DonateCraft</groupId>
<artifactId>DonateCraftV653</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</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>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>jcenter</id>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>net.dv8tion</groupId>
<artifactId>JDA</artifactId>
<version>3.8.3_463</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.paypal.sdk</groupId>
<artifactId>rest-api-sdk</artifactId>
<version>LATEST</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.11</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
</project>```
I am trying to package my JavaFX application using Maven, running it using exec:java is no problem and running maven - package yields no errors. But when I want to execute the runnable jar it returns the error 'Error: Could not find or load main class .\FormulaTelemetryApp-1.0-SNAPSHOT.jar' where the second part is the jar I want to execute.
Beneath I included my POM, I already went looking for solutions, this is where I stumbled upon the maven-jar-plugin, but including that didn't solve the problem. I also tried cleaning the project and compiling/packaging again but that didn't change anything either.
As you might notice, I am fairly new to Maven (trying to self-learn it) so there might be some strange things in the POM.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.formulaElectric</groupId>
<artifactId>FormulaTelemetryApp</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>FormulaTelemetryApp</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>11</release>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.feb.telemetry.application.TelemetryApplication</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<index>true</index>
<manifest>
<mainClass>org.feb.telemetry.application.TelemetryApplication</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<!-- use the following if you're not using a snapshot version. -->
<repository>
<id>localSnap</id>
<name>RepositoryProxyRel</name>
<url>http://127.0.0.1:8080/nexus/content/repositories/releases/</url>
</repository>
<!-- use the following if you ARE using a snapshot version. -->
<snapshotRepository>
<id>MylocalSnap</id>
<name>RepositoryProxySnap</name>
<url>http://127.0.0.1:8080/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-fxml</artifactId>
<version>11</version>
</dependency>
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>9.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.23</version>
</dependency>
<dependency>
<groupId>com.fazecast</groupId>
<artifactId>jSerialComm</artifactId>
<version>1.3.11</version>
</dependency>
<dependency>
<groupId>eu.hansolo</groupId>
<artifactId>tilesfx</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>23.0-rc1</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.21.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>RELEASE</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
As stated in the comments, the problem was two-fold: on one hand a fat jar was needed, maven-shade-plugin was used for that. Besides that a launcher class (non-application extending class) was needed as main class, as is stated in the answer to this question.
I am new to using Maven, so i might be missing something. I keep getting the below error, every time i run "maven install" or "maven test". I have already tried adding the sure-fire plugin to my pom.xml file. Which i have added below. What else could be causing the problem?
Here is the error that keeps popping up in my console every time i run the command
Here is the pom.xml for my project, where i have added the sure-fire plugin:
<?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.company.Project</groupId>
<artifactId>myprofile</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>myprofile</name>
<description>Service to retrieve my profile</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<vertx.version>3.6.0</vertx.version>
<junit-jupiter.version>5.1.0</junit-jupiter.version>
<assertj-core.version>3.8.0</assertj-core.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-dependencies</artifactId>
<version>${vertx.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-web</artifactId>
<version>${vertx.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-web-client</artifactId>
<version>${vertx.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-junit5</artifactId>
<version>${vertx.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.23.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.0.3</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>io.vertx.core.Launcher</Main-Class>
<Main-Verticle>com.company.Project.myProfileVerticle</Main-Verticle>
</manifestEntries>
</transformer>
</transformers>
<artifactSet/>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- Deploy to Nexus -->
<distributionManagement>
<repository>
<id>Projectreleases</id>
<url>http://artifactory.company.local/artifactory/ProjectReleases/</url>
</repository>
<snapshotRepository>
<id>Projectsnapshots</id>
<url>http://artifactory.company.local/artifactory/ProjectSnapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
The problem is because dependency junit-jupiter-engine inside build plugin is different from dependency declared on dependencies (5.0.3 versus 5.1.0).
When I'm in NetBeans environment, I run my Jasper report normally. But when I try the command line:
java -jar C: \ ... \ mySwingProject.jar
I am getting the following error message:
no main manifest attribute in C: \ ... \ mySwingProject.jar
My pom.xml follows:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.jus.tjmg</groupId>
<artifactId>RhServidoresDesligados</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>RhServidoresDesligados</name>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<archive>
<manifest>
<mainClass>br.jus.tjmg.rhservidoresdesligados.JFramePrincipal</mainClass>
</manifest>
</archive>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<url>http://download.eclipse.org/rt/eclipselink/maven.repo/</url>
<id>eclipselink</id>
<layout>default</layout>
<name>Repository for library EclipseLink (JPA 2.1)</name>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>2.5.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc7</artifactId>
<version>11.2.0</version>
</dependency>
</dependencies>
</project>
What could be wrong?
To create executable jar file use maven-jar-plugin instead. Seems you mistyped.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>br.jus.tjmg.rhservidoresdesligados.JFramePrincipal</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
Works fine! 'artifactId' tag value was incorrect!