lombok constant need to mvn install - java

I have a java spring boot project that uses Lombok. I love this library as it reduces code.
I have a problem here. That every time I switch on my spring-tool-suite project, I need to do:
mvn clean
mvn install
mvn update
to resolve get set dependency compilation errors.

Configure your IDE with lombok.
1.execute lombok.jar and configure IDE
2.Restart IDE
a)if IDE not working after configuration
1)goto IDE installation HOME folder and open STS.ini file add -vmargs
-javaagent:lombok.jar this two line code ther.
Note:-keep your lombok.jar in IDE installation folder also

Related

How to Run Eclipse+Maven+JUnit tests in Command Line

When I run mvn clean test, it gives me the following error:
'mvn' is not recognized as an internal or external command, operable program or batch file."
This is the link of my project.
I can run the tests by right-clicking on the Runner.java => Run as => JUnit Test. I can also run the tests from the JUnit 4 Test Explorer Tab.
I have read some articles where it's suggesting to set the PATH for Maven but all of them are about the case where you are installing Maven separately. I am not sure what PATH do I need to set when Maven is coming with Eclipse.
I did not install Maven separately, it came with my Eclipse version.
My Eclipse Version :
Eclipse IDE for Java Developers
Version: 2019-03 (4.11.0)
Build id: 20190314-1200
Some IDEs (IntelliJ for example) have their own version of maven for internal purpose. But it doesn't mean that's able to be used by the command line. If you want to compile your project using mvn clean install/package/deploy/test/etc you must install maven in your machine and set de VARs in the OS.
I guess Eclipse has the same behavior that Intellij, so please also install maven in your machine
This error means that Windows cannot find an executable program called "mvn". This means it is not on your path/current directory.
When you right click and run your junit tests, it invokes it using the JVM, using the java command. I suspect if you type "java -v" into CMD, it will not give you the same error.
Since Windows does not know where to look for maven, you must tell it implicitly, by setting your path to the directory containing the mvn executable. You can lookup "eclipse bundled maven default location" to find this, although it might be worth downloading it separately from the Apache website, and manually specifying the path.

How to run maven project on jetty in Intellij as in Eclipse?

Maven project (project name: english) [vaadin, jetty] runs in Eclipse without any problem. How to run/configure exactly the same project in Intellij? Run/Apply options are not available after below configuration. In Eclipse I set, Base directory [${workspace_loc:/english}], Goals [jetty:run], JRE, Source (english project). How to set it in Intellij?
eclipse1
eclipse2
eclipse3
intellij1
intellij2
First things first, you need to add jetty plugin for maven as a dependency, if you don't have it already in your pom.xml. More about jetty maven plugin can be found here
If you were running the project via embedded jetty plugin in eclipse, same pom.xml configuration should run successfully run when you issue same command in intellij IDE.
If there are any issues on your build, try with a "clean rebuild" before you start doing anything else. You can do that via the following command in your terminal:
mvn clean install jetty:run
You will need access your console (terminal), i.e. via Alt + F12 keys. You also need to be in the same directory that you have the pom.xml in your project.
The command will basically clean up (i.e. delete) previously build project and do a fresh rebuild of your project, then run it via embedded jetty plugin.
Be sure to read a brief introduction to maven commands: Maven in 5 minutes if needed.
After you successfully issued this command for the first time, I think you can can also issue jetty:run via View -> Tool windows -> maven project.
You can usually access it also on your right side of intellij IDE (the "m" icon, maven projects).

Added Maven dependency, Eclipse doesn't see it

I add guava 17.0 to my pom.xml, Eclipse automatically rebuilds project.
Ran mvn dependency:resolve, maven shows com.google.guava:guava:jar:17.0:compile in the list of resolved files.
However when in Eclipse I try to auto-complete com.google.g, it says "No default proposals". I've added dependencies in my pom.xml before, run mvn dependency:resolve and Eclipse picked them up immediately. What's different this time?
I've tried the following so far:
Tried cleaning the project and letting it automatically rebuild.
Clean, auto-rebuild, re-start Eclipse.
mvn clean followed by mvn install
https://stackoverflow.com/a/6913992/91933
https://stackoverflow.com/a/12978632/91933
https://stackoverflow.com/a/2393810/91933 (although I couldn't get Eclipse to accept $HOME/.m2 as the Maven repository (which it is)).
I can see target/<projname>-1.0-SNAPSHOT/WEB-INF/lib/guava-17.0.jar.
My configuration:
OS: OS X 10.9.3
Maven: 3.1.1
Eclipse: Kepler (with m2e 1.4)
The suggestion by #khmarbaise works best and solves all problems.
Just delete the project from Eclipse.
Re-import as "Existing Maven Projects" and point it towards the directory that contains the project's pom.xml file.
Let Eclipse's m2e plugin handle the rest
Worked flawlessly for me.
The following advice (taken from https://developers.google.com/appengine/docs/java/webtoolsplatform#maven) may only apply to GAE projects, but seems like it should be generally applicable (my project is GAE, so can't be sure):
The directory at the root of the Maven project must not
contain any of the following:
1. A subdirectory named target
2. A subdirectory named .settings
3. A file named .classpath
4. A file named .project
In file pom.xml inside < dependency > seleneium maybe you have defined < scope> test e.g. < scope>test < /scope>.
Removing/deleting this also can solve your problem.
At first, remove projects as markvgti suggested. I did this three times without success.
My solution was deleting ".project" files and the ".settings" directory in the several projects. Last step was reimporting as "Maven Projects" in eclipse.
I faced the issue too where my WebDriver and chrome driver was not being recognized even after adding the selenium dependencies. Followed below steps seeing the above comments.
And the issue got resolved. Thanks for the help.
Create a Maven project.
Add Maven dependencies(selenium and testng minimum)
Go to CMD to where your project is.
Run command mvn eclipse:clean
Then run command mvn eclipse:eclipse
Go to eclipse and refresh your project to apply the dependencies and then the jars are added to your project.

Eclipse m2eclipse clean, build projects, build automatically commands, what are they?

What is the command that m2eclipse runs when you
highlight a project -> Menu Project -> Clean -> Select anything -> Ok ?
It then goes on to "Building Workspace".
What is the command that allows it to do so?
The reason I am asking is that I am trying to do this from outside Eclipse, from the command line. I am trying to automate all maven stuff in a Groovy script. I am on Windows xp.
EDIT:
Also, the command update maven dependencies would be nice to have as well.
Thanks!
Maven-invocations are put in the Run and Debug menus. Just building the workspace does not run maven - it just does all the work Eclipse needs to do to know your files.
For your purposes these will suffice for the command line build:
cd /to/where/pom.xml/is
mvn clean
mvn install
No commands are directly run. Instead, the m2e plugin uses the configuration in the pom to create equivalent configurations in eclipse.
For example, if you change the source directories it will update the eclipse source directories for the java builder. If you change the target directories for the source compilation, it'll ensure that when you do a Project -> Clean, the plugin knows which directories to clean.
If you are trying to do this though a scripting language, I would recommend just running commands on the command line. The alternative would be to add the maven libraries to the classpath and to use them.

maven2: how do I get/set the location for the local .jar cache?

I'm trying to get the hibernate-sqlite project to work. I downloaded it and can run
mvn eclipse:clean
and
mvn eclipse:eclipse
like the instructions say. And I can import the project into Eclipse. But when I look at the project in Eclipse, it can't find the jars that Maven has downloaded. Where does Maven put the .jars? I don't know where this is, if I knew I could set M2_HOME in eclipse and it would all work.
Linux: /home/<user>/.m2
Windows: C:\Documents and Settings\<user>\.m2
Also, you may want to look into using the m2eclipse plugin if you are doing Maven development with Eclipse.
I found it, maven looks in its settings.xml under
<settings><localRepository>{PathHere}</localRepository></settings>
which if not found, defaults to ~/.m2/repository as Taylor L's answer mentions.

Categories

Resources