As much as I like my Maven setup, I still have the occasional problem of my updated java classes not getting deployed. Like, I'll make a change to a Java class, re-compile it, then restart my Tomcat, but for whatever reason Tomcat is acting like it can't see the change I made in the new java class -- the .class file is not being refreshed.
Here are the steps I follow to force everything to refresh. Tedious, but it works.
1. Right click on project, go to Properties, Deployment Assembly, and delete the line for target/classes.
2. Right click on project, Run As --> Maven Clean. Then Run As --> Maven Build and type "package" (if you want a jar file, or just type "compile" if you don't need the jar.)
3. Right click on project, Properties, Java Build Path. Ensure Maven Dependencies are clicked ON.
4. Right click on project, click Refresh.
5. Put target/classes back into the Deployment Assembly.
6. Go into the Servers tab, right click on server and "Clean...".
By the time Tomcat starts up, I have found that this finally refreshes my .class files. I am sure there is a better way to do it, but this is the brute force method I have discovered with rial and error and it works in a pinch.
A Computer Scientist's personal research notes Technology, Research, Spirituality
How did I ever survive without Maven?
I have only been using Maven in my active projects for about 2 months, but already I have no idea how I survived without it. I have solved so many errors that were caused by jar conflicts that I have lost count!
First, there's the conflict between some versions of Jersey and Hibernate that I resolved with Maven.
Next, when I started using C3P0 connection pooling with Hibernate and Spring, I solved another error with Maven. (I had to swap out my "c3p0" dependency for "hibernate-c3p0", then I had to fiddle with the versions of hibernate-c3p0 until it worked.)
There were several others I bumped into while switching my project to use Spring & Struts -- several dependencies to add there and get coordinated with the others.
I still use ANT for generating the WAR for production. I need ANT because I have 2 sets of configuration files -- one for dev and one for prod -- and I simply tell ANT which set of config files to build from. I don't know if Maven can do that or not.
For many years, I thought I had to choose between Maven and ANT, but what do you know, here I am using both on a daily basis.
First, there's the conflict between some versions of Jersey and Hibernate that I resolved with Maven.
Next, when I started using C3P0 connection pooling with Hibernate and Spring, I solved another error with Maven. (I had to swap out my "c3p0" dependency for "hibernate-c3p0", then I had to fiddle with the versions of hibernate-c3p0 until it worked.)
There were several others I bumped into while switching my project to use Spring & Struts -- several dependencies to add there and get coordinated with the others.
I still use ANT for generating the WAR for production. I need ANT because I have 2 sets of configuration files -- one for dev and one for prod -- and I simply tell ANT which set of config files to build from. I don't know if Maven can do that or not.
For many years, I thought I had to choose between Maven and ANT, but what do you know, here I am using both on a daily basis.
Subscribe to:
Posts (Atom)