문제

I'm building a web application with Eclipse using Maven. The server is going to be Apache Tomcat. Eclipse already has tomcat 6 libraries which you can include in your build path and Web Application Module facet to be chosen. That's the way I work without Maven.

However, Maven is able to include the required dependencies to use them in tomcat. My question is, what is the right thing, not to include them via Maven and continue doing that like before, or not to configure eclipse build path and make maven solve it?

도움이 되었습니까?

해결책

The best approach for container specific API like the server API is include it in the maven POM however set the dependency as provided scope so it will be available in your class path for eclipse however maven will not package it in the WAR file when generating it. e.G.

<dependency>
    <groupId>...</groupId>
    <artifactId>...</artifactId>
    <version>...</version>
    <scope>provided</scope>
</dependency>

다른 팁

As far as I know Maven do not solve it, if you do not specifically say that your project needs these dependences. The best way is to configure the pom.xml and set the dependencies and build the project using Maven and edit it in eclipse. So once you are done you can easily "package" (build the war) and deploy it in any server location.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top