Cannot resolve the issue for the weasis maven project - java

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]

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.

Project added in build path but eclipse showing project not exist

I have a project say A and I have another project B.
I am trying to use project B in project A and so I added project B in project A's build path specifically Classpath.
After adding the import, error got resolved from eclipse IDE but when I am doing mvn clean install there is a compilation error saying package com.examples does not exist.
I tried adding as external jars as well but still it is not working.
Project A is Spring boot project version 2.7.5.
Java version is 17.
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.568 s
[INFO] Finished at: 2022-10-23T14:48:00+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.10.1:compile (default-compile) on project proj: Compilation failure: Compilation failure:
[ERROR] /C:/Users/user/eclipse-workspace/proj/src/main/java/com/name/proj/Application.java:[6,30] package com.examples does not exist
Note: Both projects are running successfully independently.
Please help me to resolve this issue.

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.

Maven Build failure in command prompt but getting build in eclipse

I am using mvn clean command from the command prompt and build is failing.
Downloading:
https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-
plugin/2.5/maven-clean-plugin-2.5.pom
[INFO] Reactor Summary:
[INFO] ABC ......................................... FAILURE [ 2.226 s]
[INFO] BUILD FAILURE
[INFO] Total time: 3.098 s
[INFO] Finished at: 2018-11-16T15:10:36+05:30
[INFO] Final Memory: 12M/153M
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of
its
dependencies could not be resolved: Failed to read artifact descriptor for
org.apache.maven.plugins:maven-clean-plugin:jar:2.5: Could not transfer
artifact
org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central
(https://repo.maven.apache.org/maven2): Received fatal alert:
protocol_version -
> [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] For more information about the errors and possible solutions,
please
read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
But when I am using mvn clean command from inside of eclipse it is building successfully.
[INFO] ---------------------------------------------------------------------
---
Downloading:
http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-
plugin/2.4.1/maven-clean-plugin-2.4.1.pom
Downloaded:
http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-
plugin/2.4.1/maven-clean-plugin-2.4.1.pom (5 KB at 5.2 KB/sec)
-------------------------
[INFO] BUILD SUCCESS
[INFO] Total time: 4.387s
The difference i am able to see is that , in command prompt it is trying to download maven-clean-plugin-2.5 whereas from eclipse it is successfully downloading 2.4.1
But I need to run through 2.5 only .
Can anyone help me on this.
Thanks.
I don't know did you install maven globally. You can try to install maven globally. follow the steps.
Download maven from maven download link
Create or export M2_HOME="MAVEN ROOT LOCATION". Ex. : E:\SoftwareRepo\building tools\apache-maven-3.5.2
Create or export MAVEN bin folder location to PATH variable. For example: E:\SoftwareRepo\building tools\apache-maven-3.5.2\bin
Open terminal or cmd and run mvn --version to confirm maven is installed or not.
You can use this same as with Eclipse.
Then go to eclipse. and setup project.follow this steps
Import existing maven project or create a maven project
Goto project explorer and Right click on your pom.xml
then select Run As maven install.
and then what you want.
Hope it will serve your purpose. You can download a sample spring boot project .
Or you can run a maven project from terminal or cmd. Just goto project root folder and then run a maven task like maven clean install . Happy Coding :)

Unable to locate command maven in project with spring boot

I'm trying to setup a simple java rest service with spring boot and maven and I've downloaded maven and have my pom.xml located in the same folder as src so it's
src & pom.xml -> main -> java -> hello
when I'm inside the hello folder and try to run maven clean package to build my jar file it says command maven not found.
I'm still relatively new to java web dev so making sure everything is configured correctly is difficult for me. I've downloaded maven but do I need to have the actual maven files in my project?
Any help is truly appreciated.
-Adam
UPDATE:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.124s
[INFO] Finished at: Fri Oct 04 11:47:08 PDT 2013
[INFO] Final Memory: 4M/89M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/Users/adam419/Desktop/Programming/Java/dd-servlet/src). Please verify you invoked Maven from the correct directory. -> [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/MissingProjectException
Edit:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Users/adam419/Desktop/Programming/Java/dd-servlet/src/main/java/hello/GreetingController.java:[3,7] error: class Greeting is public, should be declared in a file named Greeting.java
[ERROR] /Users/adam419/Desktop/Programming/Java/dd- servlet/src/main/java/hello/Greeting.java:[3,7] error: duplicate class: hello.Greeting
[INFO] 2 errors
The pom.xml must be in the "root" folder.
/yourApp:
- pom.xml
- /src
- /main/java
...
- /test/java
...
Although you are making the mistake #Ralph has given in his answer, I don't think this mistake would give the error message you're getting. To me it sounds like you haven't installed maven correctly. The install steps are at the bottom of this page. Make sure you've followed the directions correctly.
The error you've added on says there's no pom at the directory you ran the command from. You need to run the command in the same directory that the "pom.xml" file is in.

Categories