FluentFuture Class not found with multiple AnntationProcessor - java

I am developing a simple Java 8 project with Maven and a custom AnnotationProcessor.
If I use only the Dagger 2.15 or my AnnotationProcessor, it works well, but If I use both of them, maven build will fails with the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.6.1:compile (default-compile) on project MyProject: Fatal error compiling: java.lang.NoClassDefFoundError: com/google/common/util/concurrent/FluentFuture: com.google.common.util.concurrent.FluentFuture -> [Help 1]
I tried to import com.google.common.util.concurrent.FluentFuture class from com.google.guava.guava repository (version r05, 19.0, 24.1-jre), but it has not worked.
Project structure:
There is a Maven project, what contains the annotations, and two AnnotationProcessors (one of them validates only, the other generates source code) (Based on this article)
There is another Maven project, what uses this project as a dependency. In that I would like to use Dagger 2 for dependency injection (I imported it just like it is in the description in Dagger 2 page).
What can I do?
Thank you for your help!

I downgraded to dagger 2.14.1 and stopped getting that error.

Related

quarkus dev build failes with customized outputDirectory in pom.xml of dependend module

I started with a quarkus multi maven-module project and encountered the following problem when starting quarkus in the dev mode (mvn quarkus:dev) to support hot reload for depended modules' classes:
A module "my-app" configures its' build output path via the
<project><build><outputDirectory>build</outputDirectory> in the pom.xml. The module is build successfully, and the output exists in path my-app/build instead of the default target/classes.
Then the build of another module "momsServerQuarkus", which depends on the "my-app", and which uses quarkus-maven-plugin, fails with error:
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:2.11.0.Final:dev (default-cli) on project momsServerQuarkus: Failed to run: Hot reloadable dependency de.kwsoft.moms:my-app:6.14.0-SNAPSHOT has not been compiled yet (the classes directory S:\trunk\moms\my-app\target\build does not exist)
As visible in the error message, the <outputDirectory>build</outputDirectory>is read correctly from the my-apps' pom.xml, but is appended to the default output path "target" instead of the projects root folder. I played also variables, e.g. <outputDirectory>${basedir}/build</outputDirectory>, but the variable is not resolved by the quarkus-maven-plugin.
Does anyone know how this could be solved, or whether this could be a bug?
Thank you in advance.

vaadin widgetset do not work. bug in maven plugin vaadin

I've create a vaadin application with maven using the following comand:
mvn archetype:generate -DarchetypeGroupId=com.vaadin
-DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7.7.12-DgroupId=com.example -DartifactId=myapplication -Dversion=0.1 -Dpackaging=war
It has created a right project; Now I'm going to create a custom widget, follow the instruction on
https://vaadin.com/docs/v7/framework/gwt/gwt-eclipse
The wizard new-->other--> Vaadin 8 widget creates the necessary file:
But when I try to compile I get:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.1:compile
(default-compile) on project myapplication: Compilation failure:
Compilation failure: [ERROR]
/C:/Users/fmi/eclipse-workspace/myapplication/src/main/java/com/example/client/mycomponent/MyComponentWidget.java:[3,37]
package com.google.gwt.user.client.ui does not exist [ERROR]
/C:/Users/fmi/eclipse-workspace/myapplication/src/main/java/com/example/client/mycomponent/MyComponentWidget.java:[6,40]
cannot find symbol [ERROR] symbol: class Label
I know that may be I have to add dependency in the pom, but I'm asking why the wizard has this bug?
Note in the picture I see Vaadin 8 widget, while the project has been created with archetype 7.7
Is a bug in the wizard or a mistake by me?
thanks
I've resolved adding:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client</artifactId>
</dependency>
It is necessary to compile widgets; It is still unclear why in the documentation has not reported.

Maven compile error - unable to resolve test dependency from another local project

I have two Maven projects A and B, where project B is nested in project A. The structure looks like the following:
Project A:
src/test/java:
DependencyClass.java
Project B:
src/test/java:
MyTest.java
pom.xml
pom.xml
I'm trying to import DependencyClass.java (project A) into MyTest.java (project B), and be able to invoke the methods in DependencyClass.java from MyTest.java. But when I tried to package project B, it failed at the compile phase:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project : Compilation failure:
[ERROR] MyTest.java:[7,41] package XXX does not exist
[ERROR] MyTest.java:[17,9] cannot find symbol
[ERROR] symbol: class DependencyClass.java
I have found some answers such as this and this, and I have done the following:
added the maven-jar-plugin with a goal of "test-jar" in the pom.xml of project A
added the dependency to project A in project B's pom.xml, and declared type as "test-jar" and scope as "test".
Eclipse is able to resolve DependencyClass.java without giving errors, but it just failed when I tried to build with Maven. Any suggestion or idea on what I might be missing? Thanks in advance
Edit: I have also tried adding another dependency in project B's pom.xml, with the following scope and type:
<scope>compile</scope>
<type>jar</type>
But I got more errors when building project B - now it even starts to complain about jUnit and other built-in classes.
I have resolved my error. The fix was to remove the <scope> tag. So now in project B's pom.xml, I declared two dependencies of project A, one with <type>jar</type> and another with <type>test-jar</type>, and both don't have <scope> declared.
In project A's pom.xml, the execution goal of the "maven-jar-plugin" should specify both "jar" and "test-jar".

groovy "BUG! exception in phase 'semantic analysis' in source unit sun.reflect.annotation.TypeNotPresentExceptionProxy" JAVA SPRING BOOT 1.x -> 2.x

UPDATE:
I went through the groovy test cases and found the line of of code that causes this error. It's a Spring Boot Test Annotation:
#SpringBootTest(classes = MyWebConfigClass.class)
I have a Java Spring Boot project (JDK 8) that was using 1.5.9 version and I just upgraded it to 2.4.4. I was using the groovy-all 2.4.12 jar and the spock-core. 1.2-groovy-2.4 version
Now, when I try to run mvn install or compile, I get this error:
Error occurred while calling a method on a Groovy class from classpath.: InvocationTargetException: BUG! exception in phase 'semantic analysis' in source unit
'url/path/here/to/groovy/unit/test/` sun.reflect.annotation.TypeNotPresentExceptionProxy -> [Help 1]
Has anyone seen there error before? I googled, but alot of questions were with Android and Groovy using Gradle, but this is a Java Spring project using Maven.

Getting coverage from .war-dependency in multi-module-project

I have setup a Jacoco-subproject to allow Jacoco to handle multi-module-projects in my maven-project as described here. The Jacoco project depends on all .jar-modules in my project as described in the tutuorial. But this setup only seems to work for .jar-files. Instead of understanding that my .war-project produces a .war-file Jacoco is looking for a .jar.
What do I have to do to make the .war-file to get coverage?
maybe this issue will help.
Just add <type>war</type> to the dependency in the dedicated module.
but after doing that, I got another error:
Execution default of goal org.springframework.boot:spring-boot-maven-plugin:1.5.4.RELEASE:repackage failed: Unable to find main class -> [Help 1]
after add <packaging>pom</packaging> to the dedicated module for collecting all test result, jacoco works as usual.

Categories

Resources