Im trying to enable querydsl using spring-data-jpa for a project, however Im getting some compilation errors like:
The type com.querydsl.core.types.Predicate cannot be resolved. It is indirectly referenced from required .class files
Also, when I run mvn clean install I get this:
Caused by: java.lang.ClassNotFoundException: com.querydsl.core.annotations.QueryEntities
I review the jar in my classpath and I can see querydsl-core 4.1.4, querydsl-apt 4.1.4 and querydsl-jpa 4.1.4. But the project still not compiling for me, is there any issue with springboot 1.4.1 and querydsl?
I have this in my pom.xml file
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<scope>provided</scope>
</dependency>
and the plugin
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
Am I doing something wrong?
--- UPDATE ---
I downgrade from querydsl 4.1.4 to 4.1.3 and at least is compiling the project. Now, I can start some testing I will post my findings.
I think the question still open, because by default spring boot 1.4.1 comes with querydsl 4.1.4 version.
Put dependencies in the plugin.
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</plugin>
Related
When running maven build for Google App Engine I am getting a build error:
org.apache.maven.plugin.MojoExecutionException: The DataNucleus tool
org.datanucleus.enhancer.DataNucleusEnhancer exited with a non-null
exit code.
I am trying to get Datanucleus working with JDO and data enhancer.
I have followed instructions and have included the following in my pom.xml:
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-maven-plugin</artifactId>
<version>5.0.0-release</version>
<configuration>
<persistenceUnitName>transactions-optional</persistenceUnitName>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.1.0-release</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jdo</artifactId>
<version>3.1.0-release</version>
</dependency>
</dependencies>
</plugin>
BTW this is working fine with Java 7 and no build tools. This is a new project with Java 8 and Maven. Getting same error when I run mvn -X datanucleus:enhance
Been stuck for days and have tried various iterations of the plugin config and suggestions on Stack Overflow but no luck. Any assistance would be appreciated.
See, Even I faced the same issue for days and finally realized small things can create big mess. Here you go, at the first instance refer to this link :
http://www.datanucleus.org/products/accessplatform_3_0/jdo/maven.html
and use the correct mentioned versions. The problem is, you cannot just use any version of jdo-api, datanucleus-api-jdo & datanucleus-core. These have to be in sync. Please see below I am using :
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jdo</artifactId>
<version>3.1.3</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>3.1.3</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.1.3</version>
</dependency>
<dependency>
<groupId>com.google.appengine.orm</groupId>
<artifactId>datanucleus-appengine</artifactId>
<version>2.1.2</version>
</dependency>
and plugin as :
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.maven.plugin.version}</version>
</plugin>
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>3.2.0-m1</version>
<configuration>
<api>JDO</api>
<log4jConfiguration>${basedir}/src/main/resources/META-INF/log4j.properties</log4jConfiguration>
<props>${basedir}/datanucleus.properties</props>
<verbose>true</verbose>
<enhancerName>ASM</enhancerName>
<fork>false</fork>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>3.1.3</version>
</dependency>
</dependencies>
</plugin>
Few more checks, make sure you have below in your pom :
<prerequisites>
<maven>3.0</maven>
</prerequisites>
Lastly, run the maven install and see if the enhancer works ! Logs like :
DataNucleus Enhancer (version 3.1.1) : Enhancement of classes.
DataNucleus Enhancer completed with success for 2 classes. Timings : input=594 ms, enhance=46 ms, total=640 ms. Consult the log for full details
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) --
I have just deployed after new migration changes and it supports the old datastore values in production and works like a charm !Hope it helps !
I'm using the maven exec plugin to run my project. My project has a Start class that uses embedded Jetty to run the app. The dependency in the normal part of the POM for jetty is marked as "provided" because I don't want it in the final WAR.
How do I tell the exec plugin to add the 2 jars below to the classpath when running mvn exec:exec? The executableDepedency elements do not add it to the classpath. Currently, the classpath is all of the dependency jars that are not marked test or provided.
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executableDependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>${jetty.version}</version>
</executableDependency>
<executableDependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-management</artifactId>
<version>${jetty.version}</version>
</executableDependency>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath />
<argument>net.mikeski.Start</argument>
</arguments>
</configuration>
</plugin>
Turns out there are 2 options that you can use with Maven when using exec:java (which is what I wanted). You can specify true/false for each:
use the project dependencies in the classpath
use the plugin dependencies in the classpath
So, I added my provided project dependencies as plugin dependencies and set both of the properties to true and it works.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.5.0</version>
<dependencies>
<dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-management</artifactId>
<version>${jetty.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<includePluginDependencies>true</includePluginDependencies>
<includeProjectDependencies>true</includeProjectDependencies>
<executable>java</executable>
<mainClass>com.whatever.Main</mainClass>
</configuration>
...
I am getting a warning during a maven build, that I would like to fix.
The warning generated during a maven build:
[INFO] --- aspectj-maven-plugin:1.4:compile (default) # core ---
[WARNING] bad version number found in C:\Users\DR25687.m2\repository\org\aspectj\aspectjrt\1.7.1\aspectjrt-1.7.1.jar expected 1.6.11 found 1.7.1
The pom file
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.4</version>
<configuration>
<showWeaveInfo>true</showWeaveInfo>
<source>1.7</source>
<target>1.7</target>
<verbose>true</verbose>
<Xlint>ignore</Xlint>
<complianceLevel>1.7</complianceLevel>
Parent POM
<org.aspectj.version>1.7.1</org.aspectj.version>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${org.aspectj.version}</version>
<scope>runtime</scope>
</dependency>
Set up aspectjrt version in plugin configuration
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>${version-plugin-aspectj}</version>
<configuration>
<source>${targetJdk}</source>
<target>${targetJdk}</target>
<verbose>true</verbose>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<!-- Ensure aspectj tools version used by compiler is the same version used as dependency. Avoids warning
-->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.6.12</version>
</dependency>
</dependencies>
</plugin>
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=368190
you have 1.7.1 in POM. but your local maven repository is having an older version. Try a mvn clean install.
it will download the 1.7.1 version jar.
For some reason SLF4J is removed from the classpath when you use Maven 3.3.3. I found some links with some info about it but it's not clear to me how to fix this issue.
https://github.com/gatling/gatling/issues/2632
https://issues.apache.org/jira/browse/MNG-5791#add-comment
I tried adding the dependency to the plugin itself like this:
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling-plugin.version}</version>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.12</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>performance-test-1</id>
<phase>test</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
.....
</configuration>
</execution>
</executions>
</plugin>
But that doesn't seem to work. Does anybody know how to solve this issue?
This compat issue has been fixed in 2.1.5.
Just upgrade.
Is there any way I can specify which version of Java to use when compiling my .jrxml files with Jasper Reports in Maven (using jasperreports-maven-plugin)? I saw this blog post saying claiming that Jasper uses the "default virtual machine set in your computer" and not "same version of the maven-compiler-plugin". If I cannot change or guarantee the JAVA_HOME environment variable, how can I get Jasper to compile with Java6?
Here is a snippet from my pom.xml:
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jasperreports-maven-plugin</artifactId>
<version>1.0-beta-2</version>
<configuration>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile-reports</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>5.0.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
</plugins>
Looking on the Codehaus docs, there is a parameter you can use, but it doesn't say how to specify which Java version.
Thanks!
According to this issue the folllowing parameters can help you:
<configuration>
...
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
<compiler>net.sf.jasperreports.engine.design.JRJdtCompiler</compiler>
...
</configuration>
1.0-beta-2, however, does not have these properties, so the later version is necessary. You can either use a snapshot plugin version from here, of build a plugin from source code yourself. As far as I can see, plugin code from trunk supports these parameters.
I had to make some additional configurations:
set eclipse:jdtcore as exclusion in jasperresports;
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>5.6.0</version>
<exclusions>
<exclusion>
<groupId>eclipse</groupId>
<artifactId>jdtcore</artifactId>
</exclusion>
</exclusions>
</dependency>
set org.eclipse.jdt.core.compiler:ecj as plugin dependency;
jasperreports-maven-plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jasperreports-maven-plugin</artifactId>
<version>1.0-beta-4-OPENNMS-20160912-1</version>
<configuration>
<outputDirectory>src/main/webapp/WEB-INF/reports</outputDirectory>
<maven.compiler.source>${compileSource}</maven.compiler.source>
<maven.compiler.target>${compileSource}</maven.compiler.target>
<compiler>net.sf.jasperreports.engine.design.JRJdtCompiler</compiler>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>compile-reports</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>4.4.1</version>
</dependency>
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>5.6.0</version>
</dependency>
<dependency>
<groupId>net.sf.barcode4j</groupId>
<artifactId>barcode4j</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
Note: the dependencies order of plugin jasperreports-maven-plugin was relevant for me (don't ask me why).