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.
Related
I am working on a migration activity (JDK 1.8 to JDK 11).
My pom.xml having
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<includes>**/entities/*.class</includes>
<excludes>**/entities/XML*.class</excludes>
<addDefaultConstructor>true</addDefaultConstructor>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
</configuration>
<executions>
<execution>
<id>enhancer</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>2.4.0</version>
</dependency>
</dependencies>
</plugin>
It was working fine with JDK 1.8, when I changed the JDK version to 11 I am facing this issue while running mvn install.
below is the error I am getting.
.
Can anyone please help me with this.
I got the solution, just changed the version org.apache.openjpa from 2.4.0 to 3.2.0. ( in logs there were error which was indicating towards 3.2.0 version).
may be compatibility issue with JDK11 but it solved the problem.
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>
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.
Me and my team are pretty new to java side of things.
We have created a new rest service that uses spring framework.
We are trying to get the build automated.
We have our own repo that we want to go to find dependencies.
We put all third party dependencies in this repo and want the build to look into this repo while searching for dependencies.
Our pom.xml looks like this.
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.retrofit</groupId>
<artifactId>retrofit</artifactId>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
For these spring dependencies what are all the jars we need?
How do I find out which jars should we be having in our repo so that we can build our project?
You will need to specify the repository to use in your pom file. As an example we use a Nexus repository where we put other jars needed. It also acts as a cache against the Central repositories so we don't need to explicitly include all of the jars that come from there.
You will need something like this in your pom.xml file:
<!-- location for other artifact uploads -->
<repositories>
<repository>
<id>YourRepositoryId</id>
<url>http://yourrepo.com/nexus/content/repositories/thirdparty/</url>
</repository>
</repositories>
Then your build automation will need a way to specify the user and password. In a regular Maven setup you would use your user settings.xml file and populate it somewhat like this. Different automated build systems may do it differently so you would need to see where yours gets it's Maven settings from.
<!-- This exists so that environments without a user can still access the repository. -->
<settings>
<servers>
<server>
<id>YourRepositoryId</id>
<username>yourUserName</username>
<password>yourPassword</password>
</server>
</servers>
</settings>
In regard to determine the jar files to use the Maven Dependency Plugin is a good tool for analyzing a working build to see what is included.
Hopefully this helps but if not feel free to ask any questions.
You can try something like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-dependency-plugin.version}</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/alternateLocation</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
This is part of the Apache Maven Dependency Plugin.
If you also want to get the sources:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>${maven-dependency-plugin.version}</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/alternateLocation</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
<execution>
<id>sources</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<classifier>sources</classifier>
<outputDirectory>${project.build.directory}/alternateLocation</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
And look into the alternateLocation folder. And of course you can change that folder to your preferenced location.
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).