开发者

Maven and autobuilding other Eclipse projects to your web application

开发者 https://www.devze.com 2023-03-02 07:07 出处:网络
I have made my own frameworks, and I use these frameworks in my web applications. Now I have to create JAR file for my project and then copy this jar to web application lib path. Is it possible to mak

I have made my own frameworks, and I use these frameworks in my web applications. Now I have to create JAR file for my project and then copy this jar to web application lib path. Is it possible to make Maven do this for me.

(开发者_高级运维Currently I don't use Maven, because I didn't get it to work with GAE.)


Yes of course, this is possible, any build tool can do that (even a shell script).

So in maven, you define a module for your framework. You define another module for your webapp, configured as a web app, add a dependency between them. This dependancy is enough for maven to understand that your framework module jar must be included in the web application.

Here a quick introduction to maven : http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

And here a basic config file for web apps : http://maven.apache.org/guides/mini/guide-webapp.html


You can create a maven project for your framework and another one for your web application. Then you just add your framework project as a dependency to your web application and it is automatically copied to lib path.

Generate a project for your framework:
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-quickstart

Generate a project for your web application:
mvn archetype:generate -DarchetypeArtifactId=maven-archetype-webapp

edit pom.xml of web application and add your framework as a dependency

0

精彩评论

暂无评论...
验证码 换一张
取 消