Error with JaCoCo test report generation - java

We have a JaCoco plugin in a pom.xml file for a Java project. When we build locally using mvn -U clean install, the local build failed due to the below error:
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.7.4.201502262128
:report (jacoco-site) on project: An error has occurred in JaCoCo Test report generation. Error while creating report: Error while analyzing class C:\eclipse-workspace\project\target\classes\dist\tools\lib\xml-apis.jar#org/w3c/dom/DOMException.class.
Can't add different class with same name: org/w3c/dom/DOMException -> [Help 1]
[ERROR]
Could anyone please help us with this error. Thank you.

Related

Spring Boot native:compile with multi module Maven build

I try to compile GraalVM Native Image for a Spring Boot 3.0 application with multiple Maven modules.
The module structure is like the following:
heroes-parent
|- heroes-backend
|- heroes-frontend
|- heroes-webapp
where each sub-directory is a module of the parent
pom.xml extract:
<modules>
<module>heroes-backend</module>
<module>heroes-frontend</module>
<module>heroes-webapp</module>
</modules>
When I try to build the app with (see Spring Boot docs):
mvn -Pnative native:compile
it errors with (because the parent has no classes):
[ERROR] Failed to execute goal org.graalvm.buildtools:native-maven-plugin:0.9.18:compile (default-cli) on project heroes-parent: Image classpath is empty. Check if your classpath configuration is correct. -> [Help 1]
So, I have tried to build the whole application first with mvn install and then only build the application heroes-webapp with native:compile
mvn install
cd heroes-webapp
mvn -Pnative native:compile
But this fails with the following error:
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.047 s
[INFO] Finished at: 2022-12-12T16:26:20+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.0.0:process-aot (process-aot) on project heroes-webapp: Unable to compile generated source
[ERROR] cannot access heroes.WeblateProperties
[ERROR] bad class file: /home/koc/git/work/koc/angular-spring-heroes/heroes-webapp/target/classes/heroes/WeblateProperties.class
[ERROR] unable to access file: java.nio.file.NoSuchFileException: /home/koc/git/work/koc/angular-spring-heroes/heroes-webapp/target/classes/heroes/WeblateProperties.class
[ERROR] Please remove or make sure it appears in the correct subdirectory of the classpath. /home/koc/git/work/koc/angular-spring-heroes/heroes-webapp/target/spring-aot/main/sources/heroes/WeblateProperties__BeanDefinitions.java 15:25
[ERROR] cannot access heroes.MainController
[ERROR] bad class file: /home/koc/git/work/koc/angular-spring-heroes/heroes-webapp/target/classes/heroes/MainController.class
[ERROR] unable to access file: java.nio.file.NoSuchFileException: /home/koc/git/work/koc/angular-spring-heroes/heroes-webapp/target/classes/heroes/MainController.class
[ERROR] Please remove or make sure it appears in the correct subdirectory of the classpath. /home/koc/git/work/koc/angular-spring-heroes/heroes-webapp/target/spring-aot/main/sources/heroes/MainController__BeanDefinitions.java 15:25
[ERROR] cannot access heroes.HeroesApplication
[ERROR] bad class file: /home/koc/git/work/koc/angular-spring-heroes/heroes-webapp/target/classes/heroes/HeroesApplication.class
[ERROR] unable to access file: java.nio.file.NoSuchFileException: /home/koc/git/work/koc/angular-spring-heroes/heroes-webapp/target/classes/heroes/HeroesApplication.class
[ERROR] Please remove or make sure it appears in the correct subdirectory of the classpath. /home/koc/git/work/koc/angular-spring-heroes/heroes-webapp/target/spring-aot/main/sources/heroes/HeroesApplication__BeanDefinitions.java 18:25
You can find the source code for the whole application on GitHub.
Is there any way to build a native-image with a Maven multi-module Spring Boot 3 application?
I found the issue. Visual Studio Code was open and the project was loaded using Extension Pack for Java. This was deleting the classes while Maven was building them which resulted in the error above.

Angular7 + maven with IBM websphere error (frontend-maven-plugin:1.0:npm (npm install fail))

I have a complete angular7 project and want to integrate with java.
is there any way to do it?
I am using eclipse maven + ibm websphere. (not spring boot)
I referred this post(by #TimeTraveler) and tried to follow...
however when I run command mvn clean package, I encounter this error
[INFO] --- frontend-maven-plugin:1.0:npm (npm install) # angular7test ---
[INFO] Running 'npm install' in C:\Users\eclipse-workspace\angular7test\angular-project
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 02:01 min
[INFO] Finished at: 2018-11-29T23:16:03+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.0:npm (npm install) on project angular7test: Failed to run task: 'npm install' failed. java.io.IOException: Cannot run program "C:\Users\eclipse-workspace\angular7test\node_installation\node\node.exe" (in directory "C:\Users\eclipse-workspace\angular7test\angular-project"): CreateProcess error=267, The directory name is invalid -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
and I also have a question .. based on that post, maven project looks like below
Maven Project -
src
main
java
resources
webapp
WEB-INF
web.xml
angular-project (I paste my angular project here)
node_installation ========>what is this?????
pom.xml
what is node_installation? .. is that a folder? do i need to create?
this is my package..
The error you posted indicates that Maven can't find the node.js executable node.exe in order to build your Angular project. Make sure you configure your pom as indicated on the frontend-maven-plugin readme page so that it will install node and npm into your project dir where maven expects to find it. This will create the node_installation directory you are missing and populate it with the node.exe executable, which should resolve the error.

Cannot Build kafka-connect-jdbc Source Code

The mvn install command fails and I am unable to build the kafka-connect-jdbc source code. My intention is to modify the kafka-connect-jdbc source code.
I followed the instructions
https://github.com/confluentinc/kafka-connect-jdbc/issues/456
and
https://github.com/confluentinc/kafka-connect-jdbc/wiki/FAQ
All of which do not solve the problem. Can someone please assist?
Error Message (Snippet)
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project kafka-connect-jdbc: Compilation failure: Compilation failure:
[ERROR] /java/projects/kafka-connect-jdbc/src/main/java/io/confluent/connect/jdbc/dialect/SqlServerDatabaseDialect.java:[19,38] package org.apache.kafka.common.config does not exist
[ERROR] java/projects/kafka-connect-jdbc/src/main/java/io/confluent/connect/jdbc/dialect/SqlServerDatabaseDialect.java:[20,37] package org.apache.kafka.connect.data does not exist
[ERROR] /java/projects/kafka-connect-jdbc/src/main/java/io/confluent/connect/jdbc/dialect/SqlServerDatabaseDialect.java:[21,37] package org.apache.kafka.connect.data does not exist
[ERROR] /java/projects/kafka-connect-jdbc/src/main/java/io/confluent/connect/jdbc/dialect/SqlServerDatabaseDialect.java:[22,37] package org.apache.kafka.connect.data does not exist
[ERROR] /java/projects/kafka-connect-jdbc/src/main/java/io/confluent/connect/jdbc/dialect/SqlServerDatabaseDialect.java:[23,37] package org.apache.kafka.connect.data does not exist
[ERROR] /java/projects/kafka-connect-jdbc/src/main/java/io/confluent/connect/jdbc/dialect/DatabaseDialectProvider.java:[19,38] package org.apache.kafka.common.config does not exist
[ERROR] /java/projects/kafka-connect-jdbc/src/main/java/io/confluent/connect/jdbc/dialect/GenericDatabaseDialect.java:[19,38] package org.apache.kafka.common.config does not exist
[ERROR] /java/projects/kafka-connect-jdbc/src/main/java/io/confluent/connect/jdbc/dialect/GenericDatabaseDialect.java:[20,44] package org.apache.kafka.common.config.types does not exist
Download kafka source libraries into your maven local repo and retry it should work.
The master version of kafka-connect-jdbc depends on snapshot libraries not available on the central maven repository.
Make sure to clone locally:
https://github.com/confluentinc/common.git : use mvn clean install
https://github.com/apache/kafka.git : use ./gradlew installAll
After successfully performing these steps proceed to build/modify locally kafka-connect-jdbc
Go to FAQ and than you will have information that you must :
Kafka - clone https://github.com/confluentinc/kafka.git and build with ./gradlew installAll
Common - clone https://github.com/confluentinc/common and build with mvn install

WSImport fail during maven build

I was trying build some java project, which should be work on java1.6 and maven 3.2.3. After downloading every dependencies i got error:
[ERROR] Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.3:wsimport (importWSDL) on project CRIN_V2: Cannot execute: C:\Program Files\Java\jdk1.6.0_43\bin\wsimport.exe -> [Help 1]
Is there any reason why this plugin does not work with java1.6 and maven3.2.3? some ideas?

Cannot resolve the issue for the weasis maven project

When I do Run AS> Maven Install in eclipse .. I get the following error.... Please help
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.felix:maven-bundle-plugin:2.3.7:bundle (default-bundle) on project weasis-imageio-codec-windows-x86: Error calculating classpath for project MavenProject: org.weasis.imageio:weasis-imageio-codec-windows-x86:1.2-b04 # /usr/local/AT_Dev_Env/Amritam/Other projects/Weasis-1.2.6/weasis-imageio/weasis-imageio-codec-windows-x86/pom.xml: The JAR/ZIP file (/home/sreejith/.m2/repository/org/weasis/thirdparty/com/sun/media/jai-lib/1.1.4-b05/jai-lib-1.1.4-b05.jar) seems corrupted, error: error in opening zip file -> [Help 1]

Categories