I have to work with Eclipse due to some reasons which is fresh to me.I created a simple dynamic web project using Maven,then I try to run this project with plugin called tomcat7-maven-plugin,but each time I run it with command tomcat7:run,the console shows build success but the project is automatically terminated.This really confused me,because when I deploy it on my
local tomcat, nothing happened.
from the snippet, I guess the reason is that it tells:
Skipping non-war project
This basically means that your maven project does not produce a WAR (packaging=war) hence tomcat plugin has nothing to run.
I think also that it's not really related to Eclipse here (try to run it from the command line and the results will be the same)
Please restart the eclipse and clean the project. hopefully it will work.
Related
We are currently migrating to Maven Java project on Eclipse, previously we just build project based "Web Dynamic Project" which is running smoothly, every changes to the code we just do Run as > Run on Server (Automatic build enabled), nothing else.
My question is, do we have to Run as > Maven Install, Refresh, Run as > Run on Server every single changes on our code ?
If the answer is yes, what a nightmare to us ?
I guess you can use JRebel.
Check this link for more information:
https://www.jrebel.com/products/jrebel/quickstart/eclipse
I am running into problems when using IntelliJ for Spring development. At first, the IntelliJ build command works fine and picks up changes I make to the source code. At some point, this stops working and I can only compile my sources through maven, as the build or rebuild project commands seem to do nothing anymore.
I am confused, as it works as desired at the start but then stops working at some point.
Steps to recreate:
Create a new Spring project using Spring Initializr:
curl https://start.spring.io/starter.zip -d type=maven-project -d javaVersion=11 -o demo.zip && unzip demo.zip
Start IntelliJ from the command line in that folder, this will auto-import the project: idea64 .
Write a log message in the main class and run the project using Run->Run 'DemoApplication'. This compiles the sources to the target folder and starts up the project. You should see the log message
Alter the log message, run again and the changes should be visible (so far so good)
Now re-compile the sources via maven command mvn compile and restart IntelliJ
From now on, running build or rebuild project within IntelliJ will not pick up any changes I make to any of my source files. In fact both commands don't seem to do anything at all. I have to compile via maven in order to properly compile my sources
I tried a few things to overcome this problem, but without success:
Invalidated caches/restart
Checked project settings for Project Compiler Output and set it to <project-folder>/target
Checked project settings/modules for output path and test output path and put in the path as above
Used Reimport All Maven Projects
Deleted the .idea folder within the project folder. This seems to work, but is very inconvenient and surely no intended behavior. Also it breaks again if I recreate the steps detailed above.
Is anyone experiencing similar problems and/or has a solution?
So for anyone running into the problems I described above:
Apparently deleting the .idea folder and restarting IntelliJ does indeed do the trick. The folder is recreated on restart and afterwards I'm able to switch between compiling within IntelliJ using run, build or rebuild project and compiling through maven goals (mvn compile, mvn test, mvn surefire:test, ...). This persists through restarts of IntelliJ such that I don't have to repeat this everytime I open a project.
I still don't know why this behavior happens, but it's a solution I'm happy to work with as long as I only have to do it every now and then for a project.
Sounds like do don't want Intellij's default build. You want Intellij to forward the build command to mvn. I assume this because you do not mention this step in your question.
Here's a screenshot that shows how to enable it:
More detail is available in the Intellij documentation https://www.jetbrains.com/help/idea/delegate-build-and-run-actions-to-maven.html#delegate_run_action
We have a multi-module Maven project: project-war depends on project-api.
I have imported the modules into IntelliJ, and I would like to use tomcat7:run to run run the project-war application in Tomcat. I do so, the application runs fine.
I make a change to project-api, stop Tomcat, restart Tomcat. The project-war application runs again fine, but the changes to project-api are not reflected as expected.
How to get the transitive changes from my workspace to be reflected when running tomcat7:run?
I've tried "Resolve Workspace artifacts". It didn't help. In fact, I don't get this setting at all.
I've tried "Before launch:" "Make". It does what appears to be a build (compile) but it didn't help either.
I think what I"m looking for is pretty much what m2e/Eclipse calls workspace resolution. Can't get it to work in IntelliJ. Your help much appreciated!
This is a good repository to test this out.
As it turns out, this problem existed using IntelliJ 12.1.7, but not anymore using IntelliJ 13.1.5.
Workspace resolution works with a combination of the described configuration:
Resolve Workspace Artifacts
Before launch: Make
I just started to use Eclipse and I am having issues with testing my code. It seems that every time I want to debug a piece of code I need to do a maven clean and install, and then refresh for the changes to propagate. This process takes around 5 minutes, which is extremely troublesome (if i want to change a line of code, i need to wait 5 minutes .. and then test it). Is there a way to bypass this, perhaps modify the jar files directly or is there an option/plugin in eclipse to help with this?.
I know there a auto build option but it doesnt seem to do anything .. or am i missing something?
You could use the m2e plugin to manage how eclipse integrates with maven.
http://wiki.eclipse.org/Maven_Integration
Dependency management for Eclipse build path based on Maven's pom.xml
Resolving Maven dependencies from the Eclipse workspace without installing to local Maven repository
You can download it here: http://www.eclipse.org/m2e/download/
I am considering using Maven 3 for my Spring projects which I have been developing using Eclipse and Tomcat. Until now;
I have been disabling "Republish automatically" because sometimes I don't need publish, I only save .java files (classes) and keep development on debug mode.
I republish (by clicking Eclipse's "publish" button on Servers view) only when I changed js, jsp or htm-like files, not class files, so I can keep developing without restarting Tomcat.
Now I am going to use Maven for debug/run on development but whenever I changed my code, I don't know how to do this "publish" issues on Maven as it doesn't use Eclipse's Tomcat directly. I stop maven and start again. Do I have to do this for all changes on my code? How can I make this maven -tomcat:run- "publish/republish" for js/jsp/html files and "do nothing" for .java files?
Unfortunately, yes, you'll have to run maven for every change.
Maven't isn't really intended to be used this way - it assumes that you're going to use maven when you're ready to build (ie after development), but use something like Eclipse if you're trying to see your changes in real time. It has no mechanism for listening for changes.
For my webapps I use both maven and Eclipse, with the m2e and the 'Maven Integration for Eclipse WTP' plugins. With that setup I can see my changes in real time using an embedded Tomcat instance in Eclipse, and when I'm done, I use maven to build.
Give those two plugins a shot - I think it'll meet your needs.
I had the same problem. And it happens because I ran maven eclipse:eclipse. Then, Server stop publishing (click on publish and said it was synchronized). I downloaded again .classpath and .project and other innerit files of eclipse project structure from cvs and server starts publishing again. May be this could help.
Regards,
For the benefit of Googlers:
I was getting NoClassDefFound errors using tomcat:run to start the app.
It took some googling but the following post notes that using tomcat:run-war enables your dependencies to get picked up from the WAR:
http://www.hascode.com/2010/06/java-server-facesjsf-2-tutorial-step-1-project-setup-maven-and-the-first-facelet/
However, for debugging and hot code replace, it's simplest to run Tomcat from the Servers view in Eclipse.