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.
Related
i have am running the following with this
clean jacoco:prepare-agent install jacoco:report -DENVIRONMENT=localhost -X
pom.xml
file i am running this pom in jenkins server,its a maven project with SoapUI Maven plugin ,SoapUIproject.xml is attached to maven to do automatic SoapUI tests i am getting the following error, i have tried all the stackoverflow answers related to this project and search through the web but still cant get rid of it:
[INFO] --- maven-install-plugin:2.4:install (default-install) #
soapui-maven-plugin --- [INFO] Installing
/var/lib/jenkins/workspace/soapuiauto1/hdap-project/target/soapui-maven-plugin-0.0.1-SNAPSHOT.jar
to
/home/jboss/.m2/repository/com/smartbear/soapui/soapui-maven-plugin/0.0.1-SNAPSHOT/soapui-maven-plugin-0.0.1-SNAPSHOT.jar
[DEBUG] Writing tracking file
/home/jboss/.m2/repository/com/smartbear/soapui/soapui-maven-plugin/0.0.1-SNAPSHOT/_remote.repositories
[INFO] Installing
/var/lib/jenkins/workspace/soapuiauto1/hdap-project/pom.xml to
/home/jboss/.m2/repository/com/smartbear/soapui/soapui-maven-plugin/0.0.1-SNAPSHOT/soapui-maven-plugin-0.0.1-SNAPSHOT.pom
[DEBUG] Writing tracking file [INFO] Skipping JaCoCo execution due to
missing execution data
file:/var/lib/jenkins/workspace/soapuiauto1/hdap-project/target/jacoco.exec
Notifying upstream projects of job completion
Join notifier requires a CauseAction
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
com.smartbear.soapui
soapui-maven-plugin
0.0.1-SNAPSHOT
5.3.0
BADGER
false
ENVIRONMENT
BADGER
TURKEY
false
ENVIRONMENT
TURKEY
PANTHER
false
ENVIRONMENT
PANTHER
QA6
false
ENVIRONMENT
QA6
QA7
false
ENVIRONMENT
QA7
QA8
false
ENVIRONMENT
QA8
smartbear-sweden-plugin-repository
http://smartbearsoftware.com/repository/maven2/
vonage-m2-plugin-repository
http://maven.dev.s.vonagenetworks.net:8080/nexus/content/repositories/Vonage-m2/
</pluginRepositories>
<repositories>
</repositories>
<build>
<plugins>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>${soapui.plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui</artifactId>
<version>${soapui.plugin.version}</version>
<exclusions>
<exclusion>
<groupId>javafx</groupId>
<artifactId>jfxrt</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.10</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.3-1102-jdbc41</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver</artifactId>
<version>3.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</dependency>
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>jgoodies-forms</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>com.vonage.asl</groupId>
<artifactId>unifiedServices</artifactId>
<version>2015.12.4-RELEASE</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
</dependencies>
<configuration>
<settingsFile>${basedir}/src/config/soapui-settings.xml</settingsFile>
<junitReport>true</junitReport>
<printReport>true</printReport>
</configuration>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<trimStackTrace>false</trimStackTrace>
<testFailIgnore>true</testFailIgnore>
<outputFolder>${project.build.directory}/reports</outputFolder>
<projectFile>${basedir}/src/test/resources/HDAP-soapui-project.xml</projectFile>
<projectProperties>
<projectProperty>ENVIRONMENT=${ENVIRONMENT}</projectProperty>
</projectProperties>
<junitReport>true</junitReport>
<skip>${skipITs}</skip>
<coverage>${project.build.directory}/reports</coverage>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
<!-- <configuration>
<destFile>${jacoco.reportPath}</destFile>
<dataFile>${jacoco.reportPath}</dataFile>
<outputDirectory>${project.reporting.outputDirectory}/jacoco-it</outputDirectory>
<classDumpDir>${project.reporting.outputDirectory}/jacoco-it/classes</classDumpDir>
<skip>${skipITs}</skip>
<output>file</output>
</configuration> -->
<executions>
<execution>
<id>jacoco-agent</id>
<phase>pre-integration-test</phase>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<destFile>${project.build.directory}/coverage-reports/jacoco-it.exec</destFile>
<propertyName>jacoco.agent.itArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>jacoco-report</id>
<phase>post-integration-test</phase>
<configuration>
<dataFile>${project.build.directory}/coverage-reports/jacoco.exec</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>${project.reporting.outputDirectory}/jacoco-out</outputDirectory>
</configuration>
<goals>
<!--<goal>dump</goal> -->
<goal>report</goal>
</goals>
</execution>
</executions>
<configuration>
<systemPropertyVariables>
<jacoco-agent.destFile>target/jacoco.exec</jacoco-agent.destFile>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<executions>
<execution>
<id>default-test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.15</version>
<executions>
<!--
Ensures that both integration-test and verify goals of the Failsafe Maven
plugin are executed.
-->
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<!-- Sets the VM argument line used when integration tests are run. -->
<argLine>${jacoco.agent.itArgLine}</argLine>
<skipTests>${skip.integration.tests}</skipTests>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Are you explicitly setting -DskipITs=false when running maven in Jenkins?
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>
...
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 trying to run aspectj-maven plugin with JDK8. But it is giving errors like
"The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files"
Any help on how to resolve, or if the aspectj-maven-plugin supports JDK8. I am using 1.6 version of aspectj--maven-plugin.
I had to achieve the same and I drove crazy trying to figure out this, fortunately I could solve it and here I give you what I did:
To use aspectj-maven-plugin with Java 8 you need version aspectj-maven-plugin 1.7 (Note that aspectj-maven-plugin 1.6 works for Java 7).
So, the maven plugin configuration needs to be:
<!-- AspectJ configuration -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.7-SNAPSHOT</version>
<configuration>
<complianceLevel>1.8</complianceLevel>
<source>1.8</source>
<target>1.8</target>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
</plugin>
By the way, the aspectJ jars needed are:
<!-- Spring AOP + AspectJ -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.1</version>
</dependency>
And the most important thing I've struggled was that you need to install the aspectj-maven-plugin 1.7 jar manually into your pom.xml since this jar aren't on maven repo yet.
You can get it from Haus Jira (look at the Attachment section):
https://jira.codehaus.org/browse/MASPECTJ-131
Btw, once you download it an copy it to your repo you need to create your own aspectj-maven-plugin-1.7-SNAPSHOT.pom file within the corresponding directory. You can copy it from version 1.6 BUT ensure you modify the following content:
<version>1.7-SNAPSHOT</version>
<properties>
<aspectjVersion>1.8.1</aspectjVersion>
<mavenVersion>2.2.1</mavenVersion>
<changesPluginVersion>2.9</changesPluginVersion>
</properties>
That's all here you go, hope to help.
You don't need 1.7-SNAPSHOT for that. I have this snippent in POM and everything works:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<source>1.8</source>
<target>1.8</target>
<complianceLevel>1.8</complianceLevel>
<showWeaveInfo>true</showWeaveInfo>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.1</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
</plugin>
Another way to solve this problem is to downgrade JDK level to 1.7. JDK 1.7 works well with aspectj-maven-plugin of versions 1.4 - 1.6.
Here is a screenshot showing how to change JDK level in IntelliJ IDEA project:
Set Project SDK to 1.7. See documentation for more details.
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).