Eclipse package error,but all his childPackage has no error - eclipse

I check out my code from svn, but one package has errors ,but all his sub-packages have no red-error icon.
error img http://postimg.org/image/o2veg9811/
All my project is based on 'aiis-framework' project ,So I want to make the aiis-framework project correct first.
Before I ask this question, I do 'Project->Clean' in eclipse ,and 'mvn clean compile -Dmaven.test.skip' in maven again and again ,but nothing changed.
If someone give me some advice ,it will do me a big favor.
Additional:I see the problems, it says my pom-file is not up-to-date。
But I runs these in my cmd.exe
mvn clean compile -Dmaven.test.skip
mvn eclipse:clean eclipse:eclipse -Dwtpversion=2.0 -Dmaven.test.skip
mvn resources:resources
Then refresh in the eclipse.
what it happens 'pom is not up-to-date'

Related

Errors in eclipse pom.xml but maven clean install is successful

It seems that the property ${user.dir} is recognized by Maven but not recognized by Eclipse. I am seeing the errors below in the pom.xml file in eclipse everywhere then there is a reference to this section:
<outputDirectory>${user.dir}\Nightly_Build\lib</outputDirectory>
The errors are:
Cannot invoke "org.eclipse.core.runtime.IPath.segmentCount()" because "outputDir" is null (org.apache.maven.plugins:maven-jar-plugin:2.4:jar:bpcstudioToats:package)
java.lang.NullPointerException: Cannot invoke "org.eclipse.core.runtime.IPath.segmentCount()" because "outputDir" is null
The good thing is that the command mvn clean install is working fine. I run this command from eclipse right-click run/build and from the command line, and all is working fine.
This is causing eclipse not to recognize the maven dependencies correctly, and reporting compilation errors in various places, and the compilation in maven is successful.
Any idea how to resolve this issue?
Update:
I replaced all references to user.dir with project.basedir in all pom.xml, did a project clean, and updated maven, then all errors disappeared. But, I could see a new folder was created under each project base directory. I will check what was the intent of using user.dir and then will provide an update.

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.

Eclipse can't find a class on my classpath

The project is a maven project.
run as maven install works
mvn install works
I have tried mvn eclipse:eclipse to update project, I can see the jar file in my properties order and export
I have closed and reopened the project
I have deleted and re added the project
I have done a refresh
I have done a maven update project
I have cleaned the project
maven disable maven nature and then configure convert to maven project
It builds just fine from:
The command line:
mvn install
In eclipse run as maven install
It works in intellij idea
For the love of all that is holy...
There was a class of the same name in this project with all lines commented out.
Deleting that source file fixed the problem.

Running mvn eclipse:eclipse and the build path

Apologies if this is a simple question...
When I run the mvn eclipse:eclipse command to resolve the classpaths for eclipse it always appends the projects version as well. So if the project is called "ATestProject" and the version is "3", the build path will look for "ATestProject-3" but eclipse knows it only as "ATestProject". So there is a error unless I manually add the "ATestProject".
Is there a way to exclude the version? OR am I just doing something wrong?

How to set up IntelliJ external Scala compiler for Maven projects

I'm using IntelliJ 13 community version. I have a Maven project with multiple modules.
Currently, I'm using IntelliJ internal compiler. I find that every time I run maven clean XXX, I have to manually trigger Scala rebuild in IntelliJ before I run any Cucumber acceptance tests. Otherwise IntelliJ will complaints "no class file". It is annoying. It takes 2 to 3 minutes for the clean re-build.
Finally, I decide to try the external compiler. I have no idea how to do it. I does not seems as easy as enable external compiler.
Can any one please teach me how to properly set up external compiler for a multi-module maven Scala project?
Maven clean command deletes your jar and target folder.
therefor you need to compile the maven project with the maven command "compile" / "install" after clean .
if you want to use your command line to clean and compile you can run $ mvn clean compile . but actually since "clean" is the 1st step at maven's build life cycle you only need to run the compile command . it will run "clean" (or $ mvn compile) as the 1st step of the build .
check out maven build life cycle here