EclipseLink + Maven: java.lang.NoClassDefFoundError: javax/persistence/Persistence - maven

My Persistence.xml is as follows:
<persistence-unit name="SARMPersistentUnit" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>edu.deakin.sarms.model.StudentAccount</class>
<class>edu.deakin.sarms.model.LecturerAccount</class>
<class>edu.deakin.sarms.model.Unit</class>
<class>edu.deakin.sarms.model.Enrollment</class>
<class>edu.deakin.sarms.model.Attendance</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:mysql://xx.yy.ss:3306/t2"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/>
<property name="javax.persistence.jdbc.user" value="xx"/>
<property name="javax.persistence.jdbc.password" value="ee"/>
<property name="eclipselink.ddl-generation" value="drop-create-tables"/>
</properties>
</persistence-unit>
pom.xml is as follows:
<?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>edu.deakin.sarms</groupId>
<artifactId>sarms2</artifactId>
<version>1.0-SNAPSHOT</version>
<repositories>
<repository>
<id>oss.sonatype.org</id>
<name>OSS Sonatype Staging</name>
<url>https://oss.sonatype.org/content/groups/staging</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.0</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.persistence</groupId>
<artifactId>commonj.sdo</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
<encoding>UTF-8</encoding>
<fork>true</fork>
<meminitial>128M</meminitial>
<maxmem>512M</maxmem>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>edu.deakin.sarms.service.SarmsControl</mainClass>
<addClasspath>true</addClasspath>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Still I am getting "java.lang.NoClassDefFoundError: javax/persistence/Persistence", on the line:
public static EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("SARMPersistentUnit");
Can anyone please suggest what am I doing wrong?
Cheers
Ayesha

I was doing a mvn clean install and then java -jar . Then I used the command mentioned by #ajozwk in the comment, but I had another issue, the persistence.xml file was under src/main/ instead of src/main/resources. So now my problem is fixed!

Related

My maven-cucumber-selenium-junit-allure project doesn't generate allure-results

I created an automated-test project you can see below my maven pom.xml.
If I run mvn clean test command, allure-results aren't generated but test cases run.
I read through allure documentation and looked for the solution but it doesn't work for me.
What could be the problem?
Here is my pom.xml content:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.prozenda</groupId>
<artifactId>TravelLedgerCucumber</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<allure.version>2.18.1</allure.version>
<maven.allure.version>2.11.2</maven.allure.version>
<aspectj.version>1.8.4</aspectj.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>7.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-cucumber4-jvm</artifactId>
<version>${allure.version}</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.4.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.2.2</version>
</dependency>
<dependency>
<groupId>io.qameta.allure</groupId>
<artifactId>allure-cucumber4-jvm</artifactId>
<version>2.18.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<argLine>
-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"
-Dcucumber.options="--plugin io.qameta.allure.cucumber4jvm.AllureCucumber4Jvm"
</argLine>
<systemProperties>
<property>
<name>allure.results.directory</name>
<value>${project.build.directory}/allure-results</value>
</property>
</systemProperties>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>```
The project.build.directory is a temporal directory what is generated when you build the project. Don't use that folder to store your results. Creates a folder in the root project and put the allure results in that dir.

Cannot resolve symbol #Configuration in spring webmvc project

I am creating a Spring MVC project in Intellij and when I have created WebConfigclass, the #Configuration annotation is not recognised by Intellij and it gives "Cannot resolve symbol" error. Even though I have used "import org.springframework.context.annotation.Configuration" but it could not recognise "springframework" either. Can someone help me with this.
This 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>academy.learnprogramming</groupId>
<artifactId>Todo-list</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<logback.version>1.2.3</logback.version>
<spring.version>5.0.5.RELEASE</spring.version>
<java.version>8</java.version>
<annotation-api.version>1.3.2</annotation-api.version>
<servlet-api.version>3.1.0</servlet-api.version>
<!-- <lombok.version>1.18.12</lombok.version>-->
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>${annotation-api.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>edge</version>
<scope>system</scope>
<systemPath>${basedir}/libs/lombok-1.18.12.jar</systemPath>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<target>${java.version}</target>
<source>${java.version}</source>
<release>${java.version}</release>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.6.7</version>
<configuration>
<container>
<containerId>tomcat9x</containerId>
<type>embedded</type>
</container>
<configuration>
<properties>
<cargo.servlet.port>8081</cargo.servlet.port>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
</build>
</project>
#Configuration belongs to module spring-context-${spring.version}. Make sure it appears among dependencies. Since in maven dependencies can be transitive, consider using:
mvn dependency:tree
to see which dependency brings the required jar.
When you're done, re-import the maven project into intelliJ so that the IDE will update its internal indices

Soapui PRO does not show reports in Allure

I am trying to generate Soapui-PRO execution reports with Allure. I downloaded Allure-maven plugin 2.2. I updated the POM file as mentioned below. At command prompt I run the command c:\maven\bin\mvn -o test. The test runs fine, build is successful. But the reports are html format. Can you pls check and let me know
<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.smartbear.soapuiMavenTutorial</groupId>
<artifactId>SoapUI-Maven-Tutorial</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>SoapUI-Maven-Tutorial</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-examples-parent</artifactId>
<version>1.0</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<aspectj.version>1.8.6</aspectj.version>
<allure.version>1.4.14</allure.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>2.3-SNAPSHOT</version>
</dependency>
<!--added jdbc below in build element-->
</dependencies>
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0</version>
<scope>runtime</scope>
<!--systemPath>C:\maven\ojdbc6.jar</systemPath-->
</dependency>
</dependencies>
<groupId>com.smartbear</groupId>
<artifactId>ready-api-maven-plugin</artifactId>
<version>1.3.0</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<projectFile>C:\Gee-SoapUI-Projects-Backup\25Aug2015-POSBkup\May04-2015-Point of Sale.xml</projectFile>
<outputFolder>C:\25-Aug-1suiteResults</outputFolder>
<reportFormat>xUNIT</reportFormat>
<reportName>TestCase Report</reportName>
<!--reportName>TestSuite Report</reportName-->
<testSuite>ErrorCodes</testSuite>
<junitReport>false</junitReport>
<printReport>true</printReport>
<exportAll>true</exportAll>
<soapuiProperties>
<property>
<name>soapui.home</name>
<value>C:\Users\pulipge\ReadyAPI-1.3.0\bin</value>
</property>
</soapuiProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>2.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.18.1</version>
</plugin>
</plugins>
</reporting>
</project>
Allure maven plugin should be in reporting section only. In regular dependencies you need
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-junit-adaptor</artifactId>
<version>${allure.version}</version>
</dependency>
instead. Also for advanced Allure features (like attachments and test steps) you need to configure aspectj and java agent in maven surefire plugin.
Please check the details at https://github.com/allure-examples/allure-junit-example.git.
Thanks miheys, Vania. I see now Allure report getting created!! Pls see attmt.
But it says 0 Testsuites, 0 Testcases
What could be the reason. I ran the case against 1 test suite. Can you pls check. Also I tried allure-junit-adaptor, it errored out that it cannot find files to download. So I ram wihout it. Here is my POM below.
Here is the POM
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.smartbear.soapuiMavenTutorial</groupId>
<artifactId>SoapUI-Maven-Tutorial</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>SoapUI-Maven-Tutorial</name>
<url>http://maven.apache.org</url>
<parent>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-examples-parent</artifactId>
<version>1.0</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<aspectj.version>1.8.6</aspectj.version>
<allure.version>1.4.14</allure.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>2.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-testng-adaptor</artifactId>
<version>1.4.14</version>
</dependency>
<!--Added this junit adaptor-->
<!--dependency>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-junit-adaptor</artifactId>
<version>2.2</version>
</dependency-->
<!--added jdbc below in build element-->
</dependencies>
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>http://www.soapui.org/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>10.2.0</version>
<scope>runtime</scope>
<!--systemPath>C:\maven\ojdbc6.jar</systemPath-->
</dependency>
</dependencies>
<groupId>com.smartbear</groupId>
<artifactId>ready-api-maven-plugin</artifactId>
<version>1.3.0</version>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<projectFile>C:\Gee-SoapUI-Projects-Backup\25Aug2015-POSBkup\May04-2015-Point of Sale.xml</projectFile>
<outputFolder>C:\26-Aug-1suiteResults</outputFolder>
<reportFormat>xUNIT</reportFormat>
<reportName>TestCase Report</reportName>
<!--reportName>TestSuite Report</reportName-->
<testSuite>ErrorCodes</testSuite>
<junitReport>true</junitReport>
<printReport>true</printReport>
<exportAll>true</exportAll>
<soapuiProperties>
<property>
<name>soapui.home</name>
<value>C:\Users\pulipge\ReadyAPI-1.3.0\bin</value>
</property>
</soapuiProperties>
<properties>
48 <property>
49 <name>listener</name>
50 <value>ru.yandex.qatools.allure.junit.AllureRunListener</value>
51 </property>
52 </properties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<excludeDefaults>true</excludeDefaults>
<plugins>
<plugin>
<groupId>ru.yandex.qatools.allure</groupId>
<artifactId>allure-maven-plugin</artifactId>
<version>2.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.18.1</version>
</plugin>
</plugins>
</reporting>
</project>

jOOQ 3.1 prints logs, but jOOQ 3.4 doesn't

I'm having a strange problem in my project (Spring, log4j, maven, jOOQ). The project is a multi-jar with a parent and a common poms shared by all the children projects.
The problem
If I use jOOQ 3.1 in one of the child projects, the rolling file is created and updated with all the logs. If I recompile the project using jOOQ 3.4 (jar is a dependency of the common pom project) my rolling file is not created and I don't get any logs.
Why did I upgrade from 3.1 to 3.4? Because I was getting this error.
My log4j.properties file is as follows:
log4j.rootCategory=DEBUG, stdout, rollingFile
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%5p [%t %c] - %m%n
log4j.appender.stdout.layout.ConversionPattern=%p [%c{3}] %m%n
log4j.appender.rollingFile=org.apache.log4j.RollingFileAppender
log4j.appender.rollingFile.File=${catalina.base}/logs/my_file.log
log4j.appender.rollingFile.layout.ConversionPattern=%5p %d{dd MMM yyyy HH:mm:ss} [%c] - %m%n
log4j.appender.rollingFile.Append=true
log4j.appender.rollingFile.layout=org.apache.log4j.PatternLayout
log4j.appender.rollingFile.DatePattern='.'yyyy-MM-dd
log4j.appender.rollingFile.MaxFileSize=10MB
log4j.appender.rollingFile.MaxBackupIndex=99
I can't think of a relation between the jOOQ version and printing / not printing logs, especially as the jOOQ documentation makes clear that it's very easy to log. So that's why I have to ask you guys.
Please don't hesitate to ask for more details.
Thanks everyone!
UPDATE 1 - Pom sources
These are all the concerned poms (some details have been modified for obvious reasons)
super_parent_module
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>my_group_id</groupId>
<artifactId>super_parent_module</artifactId>
<version>1.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>name</name>
<description>description</description>
<url>http://maven.apache.org</url>
<scm>
<developerConnection>XXXXX</developerConnection>
</scm>
<distributionManagement>
<!-- repository -->
</distributionManagement>
<profiles>
<!-- profiles -->
</profiles>
<properties>
<deployment.local.directory>XXXXX</deployment.local.directory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<configuration>
<configLocation>XXXXXXX</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<instrumentation>
<excludes>
<exclude>**/generated/**</exclude>
</excludes>
</instrumentation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<tagNameFormat>v#{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
<releaseProfiles>releases</releaseProfiles>
<remoteTagging>true</remoteTagging>
<tagBase>XXXXXXXX</tagBase>
</configuration>
</plugin>
</plugins>
</build>
</project>
super_common_module
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>my_group_id</groupId>
<artifactId>super_parent_module</artifactId>
<version>1.0.1-SNAPSHOT</version>
<relativePath />
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>super_common_module</artifactId>
<version>1.0.10-SNAPSHOT</version>
<name>name</name>
<url>http://maven.apache.org</url>
<scm>
<developerConnection>XXXXXX</developerConnection>
</scm>
<dependencies>
<dependency>
<!-- guava 15 -->
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>3.2.4.RELEASE</version>
</dependency>
<dependency>
<groupId>args4j</groupId>
<artifactId>args4j</artifactId>
<version>2.0.26</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ojdbc</groupId>
<artifactId>ojdbc</artifactId>
<version>14</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>${project.build.sourceDirectory}</directory>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>with-deps</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
parent_module
<?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>
<groupId>my_group_id</groupId>
<artifactId>super_parent_module</artifactId>
<version>1.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>my_group_id.client</groupId>
<artifactId>parent_module</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>parent_module</name>
<description>description</description>
<url>http://maven.apache.org</url>
<scm>
<developerConnection>XXXXXX</developerConnection>
</scm>
<modules>
<module>common_module</module>
<module>my_problematic_module</module>
<module>other_module</module>
<module>other_module</module>
</modules>
<profiles>
<!-- profiles -->
</profiles>
<properties>
<springws.version>2.1.3.RELEASE</springws.version>
<spring.version>3.2.4.RELEASE</spring.version>
<jooq.version>3.4.0</jooq.version>
<jooq-codegen.url>XXXXX</jooq-codegen.url>
<jooq-codegen.user>XXXXX</jooq-codegen.user>
<jooq-codegen.password>XXXX</jooq-codegen.password>
</properties>
<dependencies>
<dependency>
<groupId>my_group_id</groupId>
<artifactId>super_common_module</artifactId>
<version>1.0.10-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
common_module
<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>
<parent>
<groupId>my_group_id.client</groupId>
<artifactId>parent_module</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>common_module</artifactId>
<description>description</description>
<packaging>jar</packaging>
<name>name</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>${jooq.version}</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
<version>${jooq.version}</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta</artifactId>
<version>${jooq.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<!-- jOOQ configuration -->
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>${jooq.version}</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ojdbc</groupId>
<artifactId>ojdbc</artifactId>
<version>14</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.6</version>
</dependency>
<dependency>
<groupId>my_group_id</groupId>
<artifactId>jooq-ext</artifactId>
<version>1.0.3-SNAPSHOT</version>
</dependency>
</dependencies>
<configuration>
<jdbc>
<driver>oracle.jdbc.OracleDriver</driver>
<url>${jooq-codegen.url}</url>
<user>${jooq-codegen.user}</user>
<password>${jooq-codegen.password}</password>
</jdbc>
<generator>
<name>org.jooq.util.MyGenerator</name>
<database>
<name>org.jooq.util.oracle.OracleDatabase</name>
<includes>tables and packages</includes>
<excludes />
<inputSchema>my_schema</inputSchema>
</database>
<generate>
<relations>true</relations>
<deprecated>false</deprecated>
<instanceFields>true</instanceFields>
<generatedAnnotation>false</generatedAnnotation>
<records>true</records>
<pojos>false</pojos>
<immutablePojos>false</immutablePojos>
<interfaces>false</interfaces>
<daos>false</daos>
<jpaAnnotations>false</jpaAnnotations>
<validationAnnotations>false</validationAnnotations>
<globalObjectReferences>false</globalObjectReferences>
</generate>
<target>
<packageName>my_group_id.model.generated</packageName>
<directory>${project.build.directory}/generated-xxxxx/jooq</directory>
</target>
</generator>
</configuration>
</plugin>
</plugins>
</build>
</project>
my_problematic_module
<?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>
<parent>
<groupId>my_group_id.client</groupId>
<artifactId>parent_module</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<artifactId>my_problematic_module</artifactId>
<packaging>war</packaging>
<name>name</name>
<description>description</description>
<url>http://www.springframework.org/spring-ws</url>
<profiles>
<!-- profiles... -->
</profiles>
<scm>
<connection>XXXXXX</connection>
</scm>
<build>
<finalName>${project.artifactId}-${project.version}-${lane}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<attachClasses>true</attachClasses>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<url>http://localhost:8084/manager</url>
<server>mytomcat</server>
<path>/project_path</path>
</configuration>
</plugin>
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.3</version>
<dependencies>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.5</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>exec_id</id>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<target>2.0</target>
<wsdlDirectory>src/main/resources/wsdl</wsdlDirectory>
<wsdlFiles>
<wsdlFile>exec_id.wsdl</wsdlFile>
</wsdlFiles>
<extension>true</extension>
<xjcArgs>
<!-- xjcArg>some args</xjcArg -->
</xjcArgs>
</configuration>
</execution>
<execution>
<!-- another execution -->
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<instrumentation>
<excludes>
<exclude>XXXXX</exclude>
<exclude>**/generated/**</exclude>
</excludes>
</instrumentation>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>common_module</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-test</artifactId>
<version>${springws.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.jvnet.jaxb2_commons</groupId>
<artifactId>jaxb2-basics</artifactId>
<version>0.6.5</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<instrumentation>
<excludes>
<exclude>XXXXX</exclude>
<exclude>**/generated/**</exclude>
</excludes>
</instrumentation>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
I found a solution:
I have noticed that jooq-codegen-maven-3.4.0.jar has a log4j.xml and that jooq-codegen-maven-3.1.0.jar doesn't.
I have then created a log4j.xml file to replace my log4j.properties and the rollingFile has started writing again!
I believe log4j was using the xml version in jooq-codegen-maven-3.4.0.jar (which writes in console only) and not my log4j.properties. Maybe there's a way to tell log4j which file has more priority, but apparently creating this other log4j.xml has overriden jooq's.
#LukasEder, do you think this should be taken care of in jooq?
Thanks
It looks like you're missing the log4j dependency in your pom.xml file. jOOQ tries to find that dependency on the classpath, but you haven't added it (at least not in that module).
Try adding
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
(It's curious that this would have worked prior to jOOQ 3.4)

Deploy a multi-module project with Maven Cargo

In this project I'm working on, I have a big master pom file defining several modules (domain, dao, service, war).
I want to deploy my war to my remote tomcat server using Cargo.
running mvn cargo:deploy -Ptest however gives me an error that the dependency for the module domain in the module dao could not be resolved.
I've tried putting the cargo config in the war pom but still the same.
Can someone help me?
This is the parent 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.domain</groupId>
<artifactId>product</artifactId>
<version>1.2-SNAPSHOT</version>
<packaging>pom</packaging>
<dependencyManagement>
<dependencies>
<!-- Internal dependencies -->
<dependency>
<groupId>com.domain.product</groupId>
<artifactId>product-domain</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.domain.product.dao</groupId>
<artifactId>product-dao-api</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.domain.product.dao</groupId>
<artifactId>product-dao-jpa2</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.domain.product.service</groupId>
<artifactId>product-service-api</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.domain.product.service</groupId>
<artifactId>product-service-impl</artifactId>
<version>${project.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.domain.product</groupId>
<artifactId>product-war</artifactId>
<version>${project.version}</version>
<type>jar</type>
<type>war</type>
<scope>compile</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.2.0</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<!-- profiles -->
<profiles>
<profile>
<id>test</id>
<activation>
<property>
<name>environment.type</name>
<value>test</value>
</property>
</activation>
<properties>
</properties>
</profile>
</profiles>
<modules>
<module>product-domain</module>
<module>product-dao-api</module>
<module>product-dao-jpa2</module>
<module>product-service-api</module>
<module>product-service-impl</module>
<module>product-war</module>
</modules>
</project>
This is the WAR 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>product</artifactId>
<groupId>com.domain</groupId>
<version>1.2-SNAPSHOT</version>
</parent>
<groupId>com.domain.product</groupId>
<artifactId>product-war</artifactId>
<name>product</name>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.domain.product.service</groupId>
<artifactId>product-service-impl</artifactId>
</dependency>
<dependency>
<groupId>com.domain.product.service</groupId>
<artifactId>product-service-api</artifactId>
</dependency>
</dependencies>
<profiles>
<profile>
<id>test</id>
<activation>
<property>
<name>environment.type</name>
<value>test</value>
</property>
</activation>
<properties>
<!-- Deployment settings -->
<cargo.containerId>tomcat7x</cargo.containerId>
<cargo.baseurl>http://test.domain.net:8080</cargo.baseurl>
<container.url>${cargo.baseurl}/manager/text</container.url>
<container.user>tomcat-txt</container.user>
<container.password>password</container.password>
<container.pingurl>${cargo.baseurl}/${project.name}/index.html</container.pingurl>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<wait>true</wait>
<container>
<containerId>${cargo.containerId}</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
<properties>
<cargo.remote.uri>${container.url}</cargo.remote.uri>
<cargo.remote.username>${container.user}</cargo.remote.username>
<cargo.remote.password>${container.password}</cargo.remote.password>
</properties>
</configuration>
<deployer>
<deployables>
<deployable>
<groupId>com.domain.product</groupId>
<artifactId>product-war</artifactId>
<type>war</type>
<properties>
<context>${project.name}</context>
</properties>
<pingURL>${container.pingurl}</pingURL>
</deployable>
</deployables>
</deployer>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
As you can see, the war is dependent from the service, which by itself is dependent from the dao and that one from the domain.
In my opinion you have to use first a mvn install and than
mvn -pl product-war cargo:deploy -Ptest

Resources