I am looking into migrating to net.ltgt.gwt.maven:gwt-maven-plugin, and I use Lombok. So in my projects I had to have following in the plugin configuration:
<extraJvmArgs>-javaagent:${org.projectlombok:lombok:jar}=ECJ</extraJvmArgs>
How does one achieve that with net.ltgt.gwt.maven:gwt-maven-plugin?
Use jvmArgs:
<jvmArgs>
<arg>-javaagent:${org.projectlombok:lombok:jar}=ECJ</arg>
</jvmArgs>
Or if you add dependency with maven in *-client module:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
<scope>provided</scope>
</dependency>
You have to edit pom.xml in this way in plugins settings:
<plugin>
<groupId>net.ltgt.gwt.maven</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.0.0</version>
<extensions>true</extensions>
<configuration>
<sourceLevel>1.8</sourceLevel>
<failOnError>true</failOnError>
<jvmArgs>
<arg>-javaagent:${settings.localRepository}/org/projectlombok/lombok/1.18.12/lombok-1.18.12.jar=ECJ</arg>
</jvmArgs>
</configuration>
</plugin>
Related
I have a project (Spring Boot application), in which I mix Java and Groovy.
I can compile and run the project without problems inside IntelliJ Idea.
But I can't compile it with Maven.
Java 12 works fine, but when switching to 13 version it shows me next errors:
Example of POM.xml configuration:
<properties>
<java.version>13</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<javax.version>1.5.4</javax.version>
<groovy.version>2.5.8</groovy.version>
<lombok.version>1.18.10</lombok.version>
....
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<source>{java.version}</source>
<target>{java.version}</target>
<verbose>true</verbose>
<fork>true</fork>
<compilerArguments>
<javaAgentClass>lombok.launch.Agent</javaAgentClass>
</compilerArguments>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>3.6.0-03</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>${groovy.version}-01</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.10</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
Does anyone know which compiler/plugin compiles java and groovy code with the java 13 version?
Java 13 support starts in groovy-eclipse-batch 2.5.8-03, which is based upon Eclipse 4.14. https://www.eclipse.org/eclipse/news/4.13/jdt.php#Java_13
You are using 2.5.8-01. At this time, Groovy 2.5.10 is the latest release and groovy-eclipse-batch:2.5.10-01 matches that. And both offer support for Java 13.
The Apache Tika Project has a root directory within which there is a pom.xml present. Inside the Root directory there are submodules and module named "Tika-Parent". Inside Parent module there is also a pom.xml file.
Now i am adding jacoco Maven Plugin to Tika to get Code Coverage but i am facing problems because when i add Jacoco Maven Plugin to the Pom.xml in Root Directory. It builds successfully but gives an error :"Skipping JaCoCo execution due to missing execution data file:C:\Users\adity\IdeaProjects\tika-1.20\target\jacoco.exec"
I tried adding JaCOCO Plugin to both the pom.xml files together as well as one by one each also but no result.
Also when I Perform Maven Test on the pom.xml in root directory it builds successfully running all tests.
BUT when I Perform Maven Test on the Tika-parent's pom.xml it doesnt run any tests but builds successfully.
I am attaching below the Pom.xml in root directory as well as pom.xml from Tika-parent module inside the root directory.
I am using IntelliJ Community edition ( latest version on website).
Java version - JDK 8 ,
Maven version 3.
THese details are from Root directory pom.xml
<modules>
<module>tika-parent</module>
<module>tika-core</module>
<module>tika-parsers</module>
<module>tika-bundle</module>
<module>tika-xmp</module>
<module>tika-serialization</module>
<module>tika-batch</module>
<module>tika-app</module>
<module>tika-server</module>
<module>tika-translate</module>
<module>tika-langdetect</module>
<module>tika-example</module>
<module>tika-java7</module>
<module>tika-eval</module>
<module>tika-dl</module>
<module>tika-nlp</module>
</modules>
These are the properties
<jacoco.version>0.7.5.201505241946</jacoco.version>
<junit.version>4.12</junit.version>
<junit.platform.version>1.3.1</junit.platform.version>
<maven.antrun.version>1.8</maven.antrun.version>
<maven.assembly.version>3.1.0</maven.assembly.version>
<maven.bundle.version>4.0.0</maven.bundle.version>
<maven.failsafe.version>2.22.1</maven.failsafe.version>
<maven.javadoc.version>3.0.1</maven.javadoc.version>
<maven.scr.version>1.7.4</maven.scr.version>
<maven.surefire.version>2.22.1</maven.surefire.version>
<maven.shade.version>3.2.0</maven.shade.version>
<rat.version>0.12</rat.version>
These are Dependencies
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>${junit.platform.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit-pioneer</groupId>
<artifactId>junit-pioneer</artifactId>
<version>0.3.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Below are all Plugins in Build.Plugins.
This is the JACOCO Plugin
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<dataFile>target/jacoco.exec</dataFile>
<outputDirectory>target/jacoco-ut</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
This is the Surefire plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<reuseForks>false</reuseForks>
<forkCount>1</forkCount>
</configuration>
</plugin>
THis is apache Rat Plugin
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<version>${rat.version}</version>
<configuration>
<excludes>
<exclude>CHANGES.txt</exclude>
</excludes>
</configuration>
</plugin>
Rest there are no other plugins in this pom.xml
BELOW is pom.xml from Iika-Parent module in root directory.
These are the properties.
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>${project.build.sourceEncoding}
</project.reporting.outputEncoding>
<!-- plugin versions -->
<jacoco.version>0.7.5.201505241946</jacoco.version>
<junit.version>4.12</junit.version>
<junit.platform.version>1.3.1</junit.platform.version>
<forbiddenapis.version>2.6</forbiddenapis.version>
<groovy.maven.version>2.0</groovy.maven.version>
<maven.antrun.version>1.8</maven.antrun.version>
<maven.assembly.version>3.1.0</maven.assembly.version>
<maven.bundle.version>4.0.0</maven.bundle.version>
<maven.failsafe.version>2.22.1</maven.failsafe.version>
<maven.javadoc.version>3.0.1</maven.javadoc.version>
<maven.scr.version>1.7.4</maven.scr.version>
<maven.surefire.version>2.22.1</maven.surefire.version>
<maven.shade.version>3.2.0</maven.shade.version>
<rat.version>0.12</rat.version>
<!-- NOTE: sync tukaani version with commons-compress in tika-parsers -->
<poi.version>4.0.1</poi.version>
<commons.compress.version>1.18</commons.compress.version>
<commons.io.version>2.6</commons.io.version>
<commons.lang3.version>3.8.1</commons.lang3.version>
<gson.version>2.8.5</gson.version>
<osgi.core.version>6.0.0</osgi.core.version>
<cxf.version>3.2.7</cxf.version>
<slf4j.version>1.7.25</slf4j.version>
<jackson.version>2.9.7</jackson.version>
<!-- when this is next upgraded, see if we can get rid of
javax.activation dependency in tika-server -->
<jaxb.version>2.3.1</jaxb.version>
<cli.version>1.4</cli.version>
<lucene.version>7.5.0</lucene.version>
<mockito.version>2.23.4</mockito.version>
Additional Dependencies in this pom.xml ( rest all are same as earlier pom)
<dependency>
<groupId>biz.aQute</groupId>
<artifactId>bndlib</artifactId>
<version>1.50.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
<version>1.12.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>${slf4j.version}</version>
</dependency>
Below are all extra plugins in Build.plugins( rest all are same as earlier pom.xml)
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<generateBackupPoms>false</generateBackupPoms>
</configuration>
</plugin>
<plugin>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
<!-- if this version contains commons-io 2.6, remove hard-coded commons-io version below -->
<version>${forbiddenapis.version}</version>
<configuration>
<targetVersion>${maven.compiler.target}</targetVersion>
<failOnUnresolvableSignatures>false</failOnUnresolvableSignatures>
<failOnUnsupportedJava>false</failOnUnsupportedJava>
<bundledSignatures>
<bundledSignature>jdk-unsafe</bundledSignature>
<bundledSignature>jdk-deprecated</bundledSignature>
<bundledSignature>jdk-non-portable</bundledSignature>
<bundledSignature>jdk-internal</bundledSignature>
<bundledSignature>commons-io-unsafe-${commons.io.version}</bundledSignature>
</bundledSignatures>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
<goal>testCheck</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${maven.bundle.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version> <!-- versions greater than this don't like System.exit calls in tika-batch -->
<configuration>
<argLine>-Xmx3072m -Duser.timezone=UTC</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>${maven.shade.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.9.5</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M2</version>
<executions>
<execution>
<id>enforce</id>
<configuration>
<rules>
<dependencyConvergence />
<requireMavenVersion>
<version>3.1</version>
</requireMavenVersion>
</rules>
</configuration>
<goals>
<goal>enforce</goal>
</goals>
</execution>
</executions>
</plugin>
The Jacoco Plugin is present in this pom file too which is same as earlier pom file.
I tried placing in this file and building it. Didnt work. THen tried placing jacoco plugin in Root pom file , didnt work. Gives the same above mentionde error.
Please HELP!!
in my code i insert jacoco plugin in root pom under pluginManagement tag:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.9</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
And in every sub-module where I do unit test I insert the following pom.xml configuration:
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
You have to enable jacoco plugin only inside java module where there are unit test.
I'm creating maven application where I'm getting information from website.
I created maven package, but when I run jar using command:
"java -jar app-1.0-SNAPSHOT.jar" I get this error:
"java.lang.ClassNotFoundException: org.openqa.selenium.WebDriver"
It works good when I'm running it in IntelliJ.
This is my pom:
<groupId>app</groupId>
<artifactId>app</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-htmlunit-driver</artifactId>
<version>2.52.0</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.0.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>sample.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<includeScope>runtime</includeScope>
<outputDirectory>${project.build.directory}/dependency-jars/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Please help me find out what is wrong. Thanks!
there may be a chance of version mismatch as follows:
Starting with 2.53.0 you need to explicitly include HtmlUnitDriver as a dependency to include it. Version number of the driver is now tracking HtmlUnit itself.
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.53.1</version>
</dependency>
Keep same versions of Selenium-Java and HTMLUnitDriver.
OR
There might be a dependency on selenium-server-standalone.jar
If you are using DefaultSelenium (or the RemoteWebDriver implementation), you still need to start a Selenium server. The best way is to download the selenium-server-standalone.jar from the Selenium Downloads page and just use it. Furthermore you can also embed the Selenium server into your own project, if you add the following dependency to your pom.xml:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.0.1</version>
</dependency>
Note: Be aware, that the selenium-server artifact has a dependency to the servlet-api-2.5 artifact, which you should exclude, if your project will be run inside a web application container.
Reference:
http://www.seleniumhq.org/download/maven.jsp
How do I exclude dependencies from a reporting Maven plugin? The cobertura-maven-plugin annoyingly pulls in ch.qos.logback:logback-classic which causes mulitple SLF4J bindings warning during build and run. I tried inserting <dependencies> with <exclusions> to the plugin but maven for some reason does not allow that in the <reporting> section. Any help is appreciated. The relevant POM is below.
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.8</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</plugin>
</plugins>
</reporting>
This is old but I'll give my solution in case someone else has this exact issue. In my poms I inserted the following
<dependencies>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.7</version>
</dependency>
</dependencies>
Inside the definition for my Cobertura plugin.
Cobertura is using 1.1.7 anyway (in my case) check your artifacts to confirm, you just need to explicitly tell maven to pull that version when creating the plugin otherwise it will still pull the conflicting version and display the error
I have solved this issue including the "scope" tag inside logback dependencies.
This is my POM section:
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback-classic-version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback-core-version}</version>
<scope>runtime</scope>
</dependency>
I want to use #net.jcip.annotations.NotThreadSafe in my Java code. I have tried to import it is a dependency in the pom.xml for the project as of below. However, I still get the error: Is something wrong with my import?
package net.jcip.annotations does not exist
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.18</version>
</dependency>
<dependency>
<groupId>net.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<configuration>
{...}
</configuration>
</plugin>
If you do it like the above you only add the dependency to the classpath of the maven-surefire-plugin which is not what you intend. You have to give it in your pom like this:
<project...>
<dependencies>
<dependency>
<groupId>net.jcip</groupId>
<artifactId>jcip-annotations</artifactId>
<version>1.0</version>
</dependency>
...
</dependencies>
</project>
Furthermore given the dependency to surefire-juni47 is not necessary, cause surefire plugin handles this on it's own. So this can look like this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18</version>
<configuration>
{...}
</configuration>
</plugin>