Intellij MavenWrapperDownloader.java: Can not resolve symbol error - spring

Setup:
Intellij IDEA community edition 2020.2
Spring Bott starter parent: 2.3.5
Java 11
WRAPPER_VERSION: 0.5.6
mvn 2
Hi,
I googled a lot e.g. here but I just can't fix it.
I created a new mvn spring project with Intellij. When I commit the project I get errors detected by code analyses in class: MavenWrapperDownloader.java.
e.g. It reports:
Cannot resolve symbol String
I tried:
invalidate caches and restart
delete .idea folder and reimport
checked sdk setup
mvn reimport
mvn clean and then rebuild (while the build is always successful)
I'm pretty new to maven. I guess the scope of the mvn package might be wrong because the build process works as expected.
UPDATE:
I reinstallt my openjdk11. No success. Then I found out that my .mvn/wrapper dir is not set as source root. I know that was never the case in my other projects. As a trial I've set my .mvn folder as source root and now the MavenWrapperDownloader.java file is recognized as a java class and the compiler interprets the symbols. But now there is another error. It says I have to define a package name for that class because the class does not have one per default. It is pretty strange to me. I also tried to use another spring boot starter version but nothing changed
When I execute Analyze->inspect code I get the following:

I had the same problem and File -> Invalidate Caches/Restart fixed it - at least for now.
IntelliJ Ultimate 2020.3
Spring Boot Starter Parent 2.4.2
Java 15
Maven 4.0.0
Maven Wrapper 0.5.6

The easiest solution is to generate your project again with Spring Starter.
After you set up everything you need at pom file -> Generate -> Download it.
Open with your IDE and copy-paste all code sources which you have already written.

Related

Springboot not recognized on IntelliJ

Even after installing Java and Maven, creating a spring project from springinitializr is facing an issue. The issue is that the project is not recognised as spring project, the annotations, import nothing are working. Can anyone please help out
I tried to redo the process, but things were same. Is any settings.xml needs to be made but I don't see it as necessity.
When opening your project in intellij. you should do so via the import > new Project and choose the pom.xml for the generated project from spring initialize. This way it can resolve dependencies and properly open your project.
if the problem persists you can go to your MainApplication.java > right click > run as spring boot project.
If it does not put the configuration on the run shortcut on the up right of the application you can configure it by adding the command : mvn spring-boot:run and add other configurations id desired.

MULE 3.8.1 Hibernate 4.3.11 - org.hibernate.jpa.boot.archive.spi.ArchiveException: Could not build ClassFile

I am developing an application for MULE ESB CommunityEdition (3.8.1 version).
I have included (provided by MULE) SPRING 4.1.6.RELEASE in project.
For persistence layer I set up Hibernate 4.3.11.FINAL.
My code is based on this idea (https://www.ricston.com/blog/jpa-mule/).
So basically i have included in the project (besides MULE dependencies):
hibernate-entitymanager (4.3.11.Final)
hibernate-core (4.3.11.Final)
hibernate-jpa-2.1-api (1.0.0.Final)
spring-orm (4.1.6.RELEASE)
And everything was working perfectly fine until i started to use Java 8 API...
Whatever I do: any lambda, stream or anything I am still getting error:
org.hibernate.jpa.boot.archive.spi.ArchiveException: Could not build ClassFile
What I did until now:
tried to add org.javassist dependency (in version from 3.18.0-GA to 3-22.0-GA) - nothing happened,
tried to exclude org.reflections.0.9.9 dependency (mule is including that in some its core dependencies): also nothing happened
I spent on this about 5 hours I am really close to give it up... I really need hibernate cause this project will include many db operations
What else Can i Try to do?
Problem solved!!
I was using mvn dependency:tree to check if there are any org.javassist dependencies in project.
And there weren't...
Then I checked the folder: {mule_home}/lib/opt and there was an old version of org.javassist library!
So: I downloaded latest org.javassist jar and I put it in the {mule_home}/lib/user folder.
Now it works like a charm :)
Please check if your Anypoint Studio is pointing correct JDK.
Check below
Preference> Installed JRE >> It should have JDK 1.8 checked.

Importing to IntelliJ - Error package org.springframework.boot does not exist

Dear Stackoverflow Community, I have the following problem with my spring boot starter application. I imported the starter project as a new maven project into IntelliJ. But IntelliJ does not find the dependencies I specified in the pom.
Image of my Application Class:
If I try to run the project I get the following error message.
Image of the Error Message:
I already tried everything from re-installing IntelliJ to re-importing the project or redownloading the dependencies. I simply dont know why IntelliJ doesn´t find the dependencies.
My pom.xml looks as following
Image of my pom.xml:
The first time I tried to edit the pom.xml it said to me "this file does not belong to the project". Maybe this might be one reason.
Running the whole thing with 'mvn install' or 'mvn clean verify' works.
Try this and then build: mvn -U idea:idea
Had the same problem. I have tried everything: invalidating cache, deleting the whole .m2 folder, changing settings, reloding the project, nothing helped.
The solution for me was to delete the .iml files which are IntelliJ module files used for keeping module configuration. After reopening the project it worked.
The idea was not mine, I found the hint here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/203365204--package-does-not-exist-error-despite-autocomplete-being-aware-of-them
Sometimes your workspace could get corrupted.
In my case, I tried to Reload the project and it worked
in my case changed JDK version in Maven importer from JDK 11 to my local JDK version 1.8
Here is how my IntelliJ settings for spring boot application looks like
Click open -> browse your workspace -> and select POM.xml file
Check this in your intelliJ settings
Do this too [Settings --> Maven --> Importing]
I just had the same issue. My solution was to remove all dependencies from the pom, reload via maven -> Reload All Maven Projects. Run mvn compile. Add dependencies back to the pom, maven -> Reload All Maven Projects. Run mvn compile.
Now the Intellij build works.
You need to change Maven's JDK for importing option from Project JDK to the Path variable for Java on your machine.
You can get to this by going to Settings -> Build, Execution, Deployment -> Build Tools -> Maven -> Importing. Scroll down to the bottom and look for JDK for importing:. Select from the list the path variable for JAVA.
For Windows users, JAVA_HOME should be an option in the drop-down list.
Follow these steps, your problem should be solved. You just need to add Spring-framework-starter-web and Spring-framework-starter-tester from your pom.xml file.
Got to generate(ALT+Insert)
Add dependencies
Search "springframwork"
Add...
Here is the link
In my case, adding the project as maven project helped .

Netbeans project: how to add dependency without having a pom-file?

I'm trying to make an old Netbeans project run.
However, certain references are broken:
Normally, one would install mongoldb-java-driver by augmenting the pom-file accordingly, see: https://mongodb.github.io/mongo-java-driver/
However, this Netbeans project does not have a pom file (I don't know why).
How can I add the missing files and folders to the project without a pom-file?
You can try downloading the Netbeans 8.2 from Oracle directly as it will contain by default the maven plugin and in this case might solve your problem.

Spring ROO build error: no tools.jar , jdk7, pom.xml

every pioneers,
I want to try to build Spring Roo 2.0.0.M2(http://projects.spring.io/spring-roo/) with its saying of STS 3.7.0 and JDK 1.7.0_45, and I couldn't find the solution even according the post on other sites or on " Builds failing after upgrading to Java7, Missing Tools.jar and bad class versions " .
The error messages on auto generated POM.xml are:
??????????????????????????????????????
You need to run build with JDK or have tools.jar on the classpath.If this occures during eclipse build make sure you
run eclipse under JDK as well (com.mysema.maven:apt-maven-plugin:1.1.3:process:default:generate-sources)
org.apache.maven.plugin.MojoExecutionException: You need to run build with JDK or have tools.jar on the
classpath.If this occures during eclipse build make sure you run eclipse under JDK as well at
com.mysema.maven.apt.AbstractProcessorMojo.execute(AbstractProcessorMojo.java:362) at
....
?????????????????????????????????????
Even I have tried: add JDK1.7.0_45 path but not JRE path in STS project, and even I added tools.jar directly in project build-paths, and even I use "mvn generate source" and add the generate jar into source path. The error about apt-maven-plugin:1.1.3 is still there.
Is there any person who can help? I will try to use old apt-maven-plugin latter.

Resources