eclipse maven plugin problem - eclipse

I try to build project from eclipse with maven and it tells me
Build errors; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources (default-resources) on project sceneExplorer: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:2.4.3:resources failed.
but if I build project from command line all goes perfect all resources are copied and no errors are thrown
command line and eclipse use the same maven installation and settings.xml file
why does it happen?

heh, problem was in synchronization with file system, I have refreshed project in project explorer and problem has gone

Related

Maven dependencies are downloaded but eclipse won't resolve them

A multi-module maven project will be buit successfully from the command line using mvn clean install and is loaded successfully in vscode without any compilation errors.
When the same project is opened in Eclipse (version Version: 2022-09 (4.25.0), Build id: 20220908-1902), I see compilation errors for dependencies not resolved for example:
The import com.ibm cannot be resolved
I tried everything to resolve this error, nothing worked, for example:
Update maven project
Project / Clean
Remove maven feature, delete the project, reimport, and convert back to maven
The strange thing is that if I delete the repository folder from <user-home>\m2.\repository and make a simple change to any pom.xml file, the entire repository folder is downloaded. Also, I located the JAR file using VSCode (ctrl-click) and I can see the related JAR logEnglish-1.0.jar in the local .m2 repository folder <user-home>\.m2\repository\logEnglish\logEnglish\1.0\logEnglish-1.0.jar.
The problem is that only Eclipse is reporting compilation errors and a lot or maybe all of the maven dependencies are not resolved. This is also affecting the debugging option and it breaks due to such compilation errors.
Another thing I noticed is that the Maven Dependencies folder is not showing on the Project Explorer no in Package Explorer, but I can see Maven Dependencies entry in Project Properties -> Configure Build Path -> Libraries.
Please help resolve this issue so that I can clear the compilation errors in Eclipse.
Update 1:
I created a simple parent/child pom with one inner module. I was able to reproduce the problem right away.
See attached snapshots for details.
The compile errors will show only when you open the parent project. If you open the inner module directly as a separate project, no compile errors will show and I can run and debug the project. However, if I try to debug the parent project, I will get a warning due to compile errors, and I can run the project only and only after I added the jar of the inner module to the classpath of the debug configuration. If I don't add the jar file, I will get this error Error: Could not find or load main class training.FirstProjectClass. The project is being built successfully using mvn clean install and that's why I can run the project. If I run mvn clean then I cannot run the parent project.
Also, notice how the maven dependencies folder will show if you open the inner project directly, but, it won't show if you open the parent project.
In addition, I noticed if I add the inner project to the classpath of the debug config then it works also without building the project and without generating the jar file using mvn clean install.
Based on the above, the problem boils down to:
How we can resolve the dependencies of the inner modules when you open the project using the parent maven project?
If we can resolve the errors, then we can run without seeing the warning, and we have the assurance that the project is clear before running the mvn clean install command.

Spring tool suit could not build with maven

my project can be built from the command line with maven clean install but i cannot update it through maven-> update project. it says
Could not calculate build plan: Plugin
org.apache.maven.plugins:maven-resources-plugin:2.4 or one of its
dependencies could not be resolved: Failed to read artifact descriptor
for org.apache.maven.plugins:maven-resources-plugin:jar:2.4
i have tried installing maven-resources-plugin.jar manually to the repository, still its the same.

Eclipse Maven errors when I'm only using Gradle

I began to get errors after downloading Nodeclipse and creating a Gradle project with New Gradle Project -- sample project "Java Quickstart". Whenever I re-open Eclipse, I get this error:
"Updating Maven Dependencies" has encountered a problem. An internal
error occurred during: "Updating Maven Dependencies".
org/eclipse/m2e/core/internal/project/registry/ProjectRegistryRefreshJob$1
I have never used Maven, but I tried to investigate the error. When I try to open Preferences > Maven, or most (but not all) of its subfolders, I get:
Unable to create the selected preference page. An error occurred while
automatically activating bundle org.eclipse.m2e.core.ui (545).
I looked on Maven Central and there is no m2e folder in org/eclipse. I also looked in Eclipse/features for pom.xml files and I have folders starting with org.eclipse.m2e, but no org.eclipse.m2e.core.ui.
Edit:
I created a new workspace and got the same error message as soon as I created a New Gradle Project based on Java Quickstart sample project. I did this twice and the second time Eclipse logged an error. Some relevant lines from the stack trace:
Exception:org.osgi.framework.BundleException: Exception in org.eclipse.m2e.core.internal.MavenPluginActivator.start() of bundle org.eclipse.m2e.core
Exception:java.lang.NoClassDefFoundError: org/eclipse/m2e/core/internal/project/registry/ProjectRegistryRefreshJob$1
at org.springsource.ide.eclipse.gradle.core.wizards.NewGradleProjectOperation.createProjectContents(NewGradleProjectOperation.java:106)
First try to build your project from command line.
Enide 2015 by Nodeclipse has built-in Terminal Ctrl+Alt+T
run gradle build
or right-click build.gradle Run as -> gradle build
Then see and think
You are building with Gradle, so don't look at Maven preferences, but Gradle one.
Possibly you confused Gradle and Maven and made wrong preferences, you can try again in new workspace.

Maven Error While updating Dependencies

I have a maven project in which i am getting the following error. I am using eclipse IDE
An internal error occurred during: "Importing Maven projects".
Unsupported IClasspathEntry kind=4
I have followed below steps for resolving this error. The reason for this error is class path file located in your project folder.
Disable Maven Nature for your project ( If in eclipse, right click on the project --> Maven --> Disable Maven Nature).
Delete the class path file in your project folder.
Re- enable the Maven Nature Again (right click on project --> configure --> Convert to Maven Project).
Try to Maven clean, install and Run the project.
Here's a better answer: stop using eclipse.
Here's the eclipse bug page:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=394042
They seem to have no interest in fixing this issue, so if you require|prefer to use the command line for projects, then really there is no fix but to quit eclipse.

Eclipse Maven release plugin

I'm trying to generate a release with goal release:prepare, but when I run it on Eclipse I got the error:
Failed to execute goal
org.apache.maven.plugins:maven-release-plugin:2.0-beta-7:prepare
(default-cli) on project mwframework: Can't run goal clean verify:
Error while executing process. Cannot run program "mvn" (in directory
"/home/gnng/Development/work-7-maven/mwframework"):
java.io.IOException: error=2, No such file or directory -> [Help 1]
I'm using Eclipse Maven Embedded, what I doing wrong?
Thanks in advanced.
The Maven release plugin always fork a child Maven build. So, you need to use external Maven installation (e.g. configure it in Eclipse).