• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

is it OK to simply add pom.xml to eclipse web project without converting it to maven ?

 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an eclipse dynamic web application project running on tomcat.  The app is not using maven and I want to change it to maven.  I can use eclipse' built-in feature like configure--> convert to maven to change it into a maven project, by doing that I found the "earth" icon (which shows it is a web application) disappeared and the "M" maven icon appears and it auto creates a pom.xml for me to edit.   I am wondering how about a different approach -- Instead of using this eclipse built feature, can I simply add a pom.xml to the build and add folders like "target", in my pom.xml, I can specify the source and destination folder, etc, then I run maven install to create .war file.  This way I maintain the project as a web application project.  Which approach would be better ?  If you think the 2nd approach wouldn't work please explain.  Thanks.
 
Saloon Keeper
Posts: 5775
146
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What drawbacks do you see in converting it to a maven project? If the tool does the work for you, why fight it?
 
author & internet detective
Posts: 39435
768
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What feature of a web project do you lose by calling it a Maven project?
 
Bartender
Posts: 21000
128
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eclipse works with "facets". When you add a Maven facet, that doesn't remove the webapp facet from the project.
 
Linwood Hayes
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Moores wrote:What drawbacks do you see in converting it to a maven project? If the tool does the work for you, why fight it?



When you first created a dynamic web project in eclipse.  You can deploy it this way to Tomcat --- Right click the server, Add and Remove project, drop the web app to the right side , then publish and start server.

After you use eclipse tool to convert it to maven project, it seems the project is no longer a dynamic web project (the earth icon is gone), and when you right click server to do add and remove project,  you don't see that original web app anymore.   I want to maintain the flexibility of deploying in old way but make the project be a maven.

If you do a quick try you may see what I mean.   BTW, how do you deploy that web app after you convert it to maven project ?
 
Linwood Hayes
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure if this issue is directly related to this thread but I just ask anyway ---  While my log4j.xml works well with rolling and other logging stuff, I am still struggling with the question how to get those open source library (like spring, hibernate, etc) logging into the log file I specified in log4j.xml.  I have set



but no luck.  they all go to system out.  I remember once someone questioned maybe these framework do not use log4j.  But I do see some code example that using these frameworks and they set  logger for them like how I set..  Wondering how it worked for them.

BTW, I used log4j-1.2.17 and org.apache.log4j.Logger in java.

Thanks.
 
Tim Holloway
Bartender
Posts: 21000
128
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, that's a problem in complex systems that use libraries from many sources. A log aggregator such as slf4j can handle the job of re-routing all those other log API requests into log4j.
 
Linwood Hayes
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:Yes, that's a problem in complex systems that use libraries from many sources. A log aggregator such as slf4j can handle the job of re-routing all those other log API requests into log4j.



Thanks.  Could you give some resource link that talks about using slf4j to route open source ?
 
Tim Holloway
Bartender
Posts: 21000
128
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I forget where I got this. And the version numbers may be old. You may need to do some dependency foo, since it was rather sensitive to the versions of the components that interacted with it as I recall.

Note that there are 2 dependencies here. The slf4j API provides the standard interceptors for the different loggers. Then the slg4j log4j12 backend routes them through log4j. Other backends can also be used if you prefer to write your logs via some other logging framework.
 
Let's go to the waterfront with this tiny ad:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!