Adding a Web Project as a jar in an Eclipse Deployment Assembly

假装没事ソ 提交于 2019-12-04 16:42:53

I found the following solution that works for me on Eclipse Luna

  1. Project B "Project Facets" : select "Utility Module" instead of "Static Web Module" or "Dynamic Web Module"

  2. Project A "Deployment Assembly" : remove "B" and add it another time.

=> The "Deploy Path" of B is now B.jar

The easiest way is: File -> Export... -> Java -> Jar File

To use ant: open project properties, the go to Builders, Click new, selec Ant Builder, etc.

Nishant

You can do something like this:

  1. Write a shell/batch script that
    • calls ANT script of project B which creates a JAR file.
    • and then, it calls ANT script of project A.
  2. Update ANT script of project A, add a copy task. This file copy task will use relative path to copy the JAR file created in step#1 to project A's WEB-INF/lib directory.
  3. In Eclipse, go to External Tool > External Tools Configuration > Program > New Progam and add this Shell/Batch script to it.

Whenever you want to build. Run this external tool from menu.This will ensure

  • Your build always has the latest of Project B
  • ANT tasks will stay small.

Adding a Web Project in an Eclipse Deployment Assembly

I did not know any such thing, until Thorbjørn Ravn Andersen pointed this out in another question where I answered. As mentioned there:

What goes in the deployment is determined not by the build path but by the Deployment Assembly entry in Preferences for the dynamic web project.

But, may be, you have already tried this.


Edit#1: fixed grammar Edit#2: added more info

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!