Lombok with Spring Tool Suite 4 - spring

I've recently installed the new Spring Tool Suite 4 in macOS High Sierra but when I tried to run Lombok's installation it wouldn't find my STS installation,
I followed this steps for manual installation (adding -javaagent to the ini file) but with no luck: https://www.edvpfau.de/sts-spring-tool-suite-4-mit-lombok/.
Any idea?

I did install Lombok in Spring Tool Suite 4 just some days ago for Mac and Windows.
And none problems.
One:
Execute java -jar lombok.jar
Note: normally or by default, it does not find the installer, it is the common scenario in my experience.
Two:
Press the Specify Location button. Therefore proceed to find and select the STS.ini file. It could be SpringToolSuite4.ini too.
Note: for Mac, go to the Contents directory within the .app file
Conclusion: therefore for any OS, the goal is find the unique file with the .ini extension
Normally I do this with the IDE closed.

Although this might be late, but it can be of help for others just experiencing this. Bellow is how I solved this issue
STEP 1
Find lombok in your project maven directory -> Right click -> Run As -> Java Application
STEP 2
Click on Specify Location button to choose the path where STS is installed
STEP 3
Go to Application/Contents/Eclipse/SpringToolSuit4.ini Then click on Install -> Quick Installer
STEP 4
Restart STS you good to go

I renamed SpringToolSuite4.exe and SpringToolSuite4.ini to STS.exe and STS.ini. Then used lombok installer's Specify Location to find them. After lombok installed, I renamed those files back to their original names.

I faced same issue with for Spring tool suite 4
Solution
Close running STS.
Open terminal
Go to ~/.m2/repository/org/projectlombok/lombok/version
Run java -jar lombok-version.jar
Pop window will come.
If it does not pick up the STS itself. Then chose specify location
Choose SpringToolSuite4.ini at ⁨Applications⁩ ▸ ⁨SpringToolSuite4⁩ ▸ ⁨Contents⁩ ▸ ⁨Eclipse⁩ .
Click install
After this Starts Spring tool suite and clean project.

Just to add to M. Jordan's and prodigy's answer, please be sure to give execute permission to lombok.jar
(After you follow the above-mentioned step) Open terminal and change directory to the content of SpringToolSuite.app
cd /Applications/SpringToolSuite4.app/Contents/Eclipse
Then check whether execute permission is available to lombok.jar
ls -al
If you see -rw-r--r-- it means you need to give execute permission
chmod +x lombok.jar
alternatively you could also do
chmod +x /Applications/SpringToolSuite4.app/Contents/Eclipse/lombok.jar
Then restart STS

I'll show you how to completely install lombok into Spring Tool Suite 4 or latest version. First go to your project pom.xml file and add this dependency on dependencies section.
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
Go to your project root folder on your IDE and click the right button on it. Select like below:
And make sure, checked Force Update of Snapshots/Releases. Click Ok to download and update dependencies.
After finishing all task. Go to project Maven Dependencies and find lombok.jar file (>Maven Dependencies >lombok.jar). Right click on lombok jar. Go to Run As Java Application.
It will open lombok installer window and click ok. Then click Specify Location button.
Select the location where your STS bundle was installed. If it is selected properly then it will checked STS.exe, like below:
Then click install/update button. Finally lombok will be installed successfully.
Hopefully it helps you. Thanks.

None of the steps worked for me as the file dialog box won't even let me select the directory containing the SpringToolSuite4.ini
So I did the following:
Get lombok-<version>.jar from either your ~/.m2/repository/org/projectlombok/lombok/<latest-version>/
If not available you can get it from mvn repository:
https://mvnrepository.com/artifact/org.projectlombok/lombok/1.18.6
copy the lombok-<version>.jar to /Applications/SpringToolSuite4.app/Contents/Eclipse as lombok.jar
cp /path/to/lombok.jar /Applications/SpringToolSuite4.app/Contents/Eclipse/
Edit the file: /Applications/SpringToolSuite4.app/Contents/Eclipse/SpringToolSuite4.ini inside the directory to add this last line:
-javaagent:/Applications/SpringToolSuite4.app/Contents/Eclipse/lombok.jar
Open your project in eclipse. Right click on Maven -> update project. Follow similar step if you're using another build tool (like Gradle)

In my case, Lombok 1.16 could not locate STS 4 installation even after pointing to it manually. Worked only after I tried with updated Lombok version - Lombok 1.18.

Turn off STS
Install lombok following other common guidances with jar.
Turn on STS

I spent like 3 or 4 hours looking for a solution to the Lombok problem with springo book and eclipse, the solution I found on the internet was the following, I leave the link: (https://projectlombok.org/all-
versions) where is the entire Lombok version and I chose the latest lombok version then updated the IDE and MVN and everything worked.

For Latest Mac OS Big Sur
Just place lombok jar In Application folder then Follow the steps
folder path /Applications/SpringToolSuite4.app/Contents/Eclipse
once you complete all the steps restart your IDE
1.
2
3.
4.
5.
6.

the easiest way you can do is that by running the following command on command prompt
java -jar (jar location/lombok.1.8.1.jar) install (the path where you installed Spring tool suite(STS))
for example:
java -jar C:\Users\karthick\.m2\repository\org\projectlombok\lombok\1.18.8\lombok-1.18.8.jar install D:\STS_Tool\spring-tool-suite-4-4.1.2.RELEASE-e4.10.0-win32.win32.x86_64\sts-4.1.2.RELEASE
after that, you have to restart the tool.

on macOS Catalina all I had to do was to use lombok 1.18 and all worked fine.

I did it in a different way. just did the below.
Copy the lombok.jar to the root directory of STS
Added "-javaagent:lombok-1.16.18.jar" to the SpringToolSuite4.ini
It worked for me.

I had the same issue with STS-4.6 and lombok-1.18.18 on Windows10. I added lombok dependency to pom.xml, built the project, ran lombok jar in .m2 repository and restarted STS. Building the project did not work. Finally, Project -> Build All worked.

after install lombok project into your eclipse--
Go to the eclipse sts4 folder--
get the permission to the lombok.jar
$chmod +x lombok.jar
then open the eclipse.

Step to add lombok project in your eclipse--
download lombok jar and place one folder.
edit the SpringToolSuite4.ini file which is exist in the eclipse folder.
add three lines in last of file--
--add-modules=ALL-SYSTEM
-javaagent:/spring-tool-suite-4-4.10.0.RELEASE-e4.19.0-linux.gtk.x86_64/sts-4.10.0.RELEASE/plugins/org.projectlombok.agent_1.18.20/lombok.jar
restart the eclipse.

best option is through install new software option built in ecliplse
help>install new software> and add this site https://projectlombok.org/p2
you are good to go

Although this might be late, but it can be of help for others just experiencing this. Bellow is how I solved this issue
STEP 1
Find lombok in your project maven directory -> Right click -> Run As -> Java Application enter image description here
STEP 2 Click on Specify Location button to choose the path where STS is installed
enter image description here
Install -> Install/Update Installer
STEP 3 Go to Application/Contents/Eclipse/SpringToolSuit4.ini Then click on Install/update
STEP 4 Restart STS you good to go
Restart your IDE and Run Project->Update Maven Project and then all your errors will be gone

Related

UNABLE TO CREATE A NEW SPRING STARTER PROJECT

I'm not able to create a spring starter project in sts tool(spring tool suite).
While trying to create a new spring starter project then I have received the "Artifact transfer exception" error.
And also I have attached the screen shot for the same.
Can you help on this.
Try spring initializer (https://start.spring.io/), just substitute your values, then click generate, unarchive project and open, and all must works.
Acoording to the link that Stephen C said in his comment:
m2eclipse issues ArtifactTransferException - But pom.xml compiles / installs from the command line
Open folder by running this text (without Quotes) in Search Explorer of Window “%USERPROFILE%.m2″.
After running above command, “m2″ folder of maven will open. Now search for file (without Quotes) “*.lastUpdated”.
In this step, delete all the files found by running Step 2.
Now go to Eclipse project and select “Maven | Update Dependency” or “Maven | Update Project”.

Run Corda project on IntelliJ

I'm using a MacBook Air OS X 10.9 (Mavericks) and IntelliJ IDEA, but the IDE won't let me execute the test "ProjectImportedOKTest" which is in src/test/java/java_bootcamp/. I followed the exact same steps of this video:
https://www.youtube.com/watch?v=ZgKxjwImKAs&index=3&list=PLi1PppB3-YrVq5Qy_RM9Qidq0eh-nL11N
But for some reason my green arrow to run the test is always disabled. It could be something with the configuration option in the top left of IntelliJ, which I left blank or even something with gradle.
Thanks a lot!!
You can invalidate the caches of the intelliJ by using the option
file -> invalidate caches/Restart.
It helped for me.
There are several things you could try.
Ensure that your source java or kotlin folder is marked as "Sources Root". Do this by right clicking the folder and selecting "Mark Directory as"
Go to view -> Tool Windows -> Gradle and hit the refresh icon
Try opening the project a different way, such as importing the project or just opening the project
Rebuild the project and ensure there are no errors
Go to File -> Project Structure and ensure Java 1.8 is set as the Project SDK
Got to File -> Settings 0> Build, Execution, Deployment and select Gradle. Ensure Gradle JVM has Java 1.8 and that "Use default gradle wrapper" is selected.
Again under Settings and Build, Execution, Deployment, go to Compiler -> Kotlin Compiler and check that Target JVM version is set to 1.8
I ran into the same problem running on Windows and ran into this question trying to find the solution. It turns out Gradle wasn't installed on my machine and that was causing the problems.
According to the Corda Docs - "Gradle - we use 4.10 and the gradlew script in the project / samples directories will download it for you."
However, I installed from the Gradle website here - https://gradle.org/install/#with-a-package-manager -and configured it in the PATH variable. After doing so, my green arrow was enabled and I was able to run the test successfully.

no executable code found at line intellij 14

I am unable to debug remote applications due to: No executable code at line
I am running ultimate edition of Intellij, version 14.0.3. My application is running inside tomcat 8 and i'm building it from the command line using Maven. This problem appeared after i switched from the community edition to the ultimate edition.
Project sources are the same and I am able to connect to tomcat for remote debugging. The only issue is that all my breakpoints are invalidated.
Please advice on how to fix this issue.
Cheers.
Remove all IDEA related project files and open the project by the .pom file.
I've had the same problem. Simply compile the directory that the class resides, and the debugger will pick up the break point.
I had the same problem and I implemented a similar solution.
Remove all IDEA related project files and open the project by the .pom file.
I use Gradle for my projecto, so i removed the project from intellij and then reimported it.
I hope others could read it and helps them
if you are developing an Atlassian plug-in and connected to the server via remote debug, run atlas-package to sync deployed plug-in and your source code.
If you are running a maven project execute the following commands in cmd prompt.
mvn clean install
mvn compile
This will resolve the problem.
The solution that worked for me is much more embarrassing. I put the breakpoint on the wrong line.
You see two breakpoints, first one is working and the second one is complaining about "no executable code ...".
It turns out there really is no executable code, just a string.

Unable to open Spring source tool suite

I installed SpringSource Tool Suite after which I was alerted that I hadn't set the JAVA_HOME. The installation was successful by then, so I closed the suite and set the java_home.
But now I don't find any way to open the suite. No shortcut in desktop or start menu.
How to open it?
Or should I re-install it?
In windows 7 go to Start > search program and files and type spring then in the results you will find Spring Tool Suit.
Else if you remember the installation path, to there you can find the STS.exe file
I face the same issue, was unable to open STS because of the Lombok path .inc file of STS.
remove the path and start.
Suggestion
if you added some external project like Lombok and did not install properly and you removed that project due to some reason then you must remove the path from the inc STS file.

Maven ignores settings.xml file

I have added proxy configuration in settigns.xml file, but it is not used by Maven, i confirmed this by making the settings.xml file invalid. I ran the maven install command to update settings and global-settings to point to the correct file, still no luck. I am using maven3.0.4.
Try running Maven with the -X option. It should print as part of the debug output which settings file is being used.
Since you already tried it with an invalid file, I bet that something is wrong with the location of your file.
It's almost to stupid to tell, but it might save some time for somebody else: If you're using a new computer, make sure file extensions are displayed. Otherwise your "settings.xml" file probably is a "settings.xml.txt" file in fact...
Make sure it is in the right directory (HOME/.m2/settings.xml)
You can find the relevant paths and a proxy example here: Maven proxy settings not working
And of course the reference is always useful: https://maven.apache.org/settings.html
have you tried with these options: from the command line to specify the settings file?
mvn -o –Dmaven.repo.local=$HOME/.my_m2path/repository clean install --settings $HOME/.my_m2path/settings.xml Dcheckstyle.skip=true –DskipTests
Some options that might not be necessary
-o is for offline (unless you have all your repos in your m2, its suggested to skip this option)
skip tests is for skipping tests while building
–Dmaven.repo.local - repo path - if you are having own repo path, then use this option
--settings $HOME/.my_m2path/settings.xml (remember there is space between settings and the path)
Since there is no accepted answer, and I encountered that problem today and other answers proved unhlepful as the file path was correct:
The solution is to restart your computer. No, seriously. After restart maven is guaranteed to read settings.xml file again and use whatever changes you made.
For those using Linux
In the Ubuntu package repository (and probably other disto's too), there are two maven packages: maven and maven2. For some reason, I had maven2 installed, which seems to ignore settings.xml in ~/.m2.
As a solution, I removed it using
sudo apt-get purge maven2
and installed the other one with
sudo apt-get install maven
What's going on?
I couldn't find a reliable source, but apparently, maven2 is an older version (2.x), as the latest maven has version 3.x and is served with maven.
Please make sure you are using the settings.xml which you modified.
for example: your using IDE's embedded maven which using different settings.xml in you operation system.
You can set the path of settings file in Eclipse* as :
In the menubar goto Window -> Preferences
In Preferences Dialog, Goto Maven Section(On the left) and Expand it.
Click on UserSettings.
Add the path of settings file using Browse. The default for most users will be (C:\Users\.m2\settings.xml). It will be shown in grey but you need to actually enter the location.
Click on Update Settings !
You can also enable debug logs and stack traces for debugging by clicking on the Maven Section in the Preferences dialog and Checking the box against the label "Debug Output".
P.S. I am currently using Eclipse(Neon) on Windows 10 x64.
I have also been facing the same issue. I removed the file and folder, but still maven was still picking the settings.
For me, restarting the system solved the issue.
What I found was that even if I set my own maven setting file using the --settings or -s command such as:
mvn -s $MAVEN_HOME/libexec/conf/my-settings.xml clean
Maven was still reading the default global setting.xml
Two ways that one can slove this:
Rename the setting.xml to something like setting.xml.bak in the $MAVEN_HOME/conf dicrectory.
The preferred approach add global to the command -gs hence the final command becomes:
mvn -gs $MAVEN_HOME/libexec/conf/my-settings.xml clean

Resources