
The motive for writing this article was the reading of the post
“Rapid Development of Web Applications in Java” and a small cognitive dissonance that arose after reading and the question that continues to torment me - Why is it so difficult? If there is a WTP!
Next, I'll tell you how I am developing under tomcat.
Local development
')
For local development, I use WTP, it is much more convenient than regular project launches / restarts, all updates are picked up on the fly. And I
am willing to argue with
asolntsev on the gravity of the plugin.
Everything is configured very simply. In Eclipse, File-> New-> Other ...-> Server, then select the required server and the server where the server instance is locally installed (for example tomcat) and click Finish. Now a new server has appeared in the “Servers” view, which can be launched and to which web projects can be published.
In fact, Eclipse uses the installed instance, but takes configs to work from the .metadata \ .plugins \ org.eclipse.wst.server.core \ tmp [0] \ folder, if desired, you can edit them directly.
If the project is maven, there is nothing complicated about it either. We install the m2eclipse plugin, add the plugin's
m2e-extras repository, and reinstall Maven Integration for WTP, after which it is possible to publish mvn web projects to WTP.
Virtues
- No need to restart the project - changes are picked up on the fly
- We get rid of the errors associated with the features of the container
- Logs are displayed in the console in Eclipse
disadvantages
- Sometimes the project is not running and is not updated - it is treated by the right button on the “Clean ...” server.
Remote development
When the project in my opinion is ready, I post it on the test server by running the task in ant, for this I have to register paths to catalina-ant.jar, jasper-compiler.jar, jasper-runtime.jar, servlet-api in the build-e. jar, commons-logging.jar. You can read about setting up deployments via ant
here .
<taskdef resource="org/apache/catalina/ant/catalina.tasks" classpathref="tomcat.classpath" /> <target name="deploy_test" depends="war" description="Create a war file"> <undeploy url="${tomcat.node1}/manager" username="admin" password="admin" path="/test" failonerror="no"/> <undeploy url="${tomcat.node2}/manager" username="admin" password="admin" path="/test" failonerror="no"/> <deploy url="${tomcat.node1}/manager" username="admin" password="admin" path="/test" war="${distrib}" /> <deploy url="${tomcat.node2}/manager" username="admin" password="admin" path="/test" war="${distrib}" /> </target>
All - the updated version of the project went to the server (or to several servers).
Virtues
- Ease of use
- Update reliability
disadvantages
- War is required before posting
Conclusion
These methods do not claim to be universal, but I did not encounter tasks when it would be impossible to use this scheme of work. I would also like to hear your opinion on these methods of work.