如何排除JAR被添加到WAR文件中 [英] How to exclude Jars from being added in the WAR file
问题描述
/ WEB-INF / lib
中。我不希望这些文件被添加,因为它们已经存在于容器中。 有没有办法?
有关详细信息,这是.classpath文件的内容:
<?xml版本=1.0encoding =UTF-8?>
< classpath>
< classpathentry kind =srcpath =src / common/>
< classpathentry kind =srcpath =src / service/>
< classpathentry kind =srcpath =src / web/>
< classpathentry kind =srcpath =src / persistent/>
< classpathentry kind =srcpath =src / dao/>
< classpathentry kind =conpath =org.eclipse.jdt.launching.JRE_CONTAINER / org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType / jre7>
<属性>
< attribute name =owner.project.facetsvalue =java/>
< / attributes>
< / classpathentry>
< classpathentry kind =conpath =org.eclipse.jst.j2ee.internal.web.container/>
< classpathentry kind =conpath =org.eclipse.jst.j2ee.internal.module.container/>
< classpathentry kind =conpath =org.eclipse.jdt.USER_LIBRARY / JBoss JSF>
<属性>
< attribute name =owner.project.facetsvalue =jst.jsf/>
< / attributes>
< / classpathentry>
< classpathentry kind =conpath =org.eclipse.jdt.USER_LIBRARY / JBoss Servlet/>
< classpathentry kind =conpath =org.eclipse.jdt.USER_LIBRARY / JBoss log4j/>
< classpathentry kind =outputpath =build / classes/>
< / classpath>
我的应用程序的部署程序集:
尝试这个
- 打开项目属性
- 选择部署程序集
- 选择库您需要从战争文件中排除,然后单击删除。
您选择的Jars将从War文件中删除
或尝试向.classpath文件添加一个属性
< classpathentry kind =conpath =org.eclipse.jdt.USER_LIBRARY / JBoss JSF>
<属性>
< attribute name =owner.project.facetsvalue =jst.jsf/>
< attribute name =org.eclipse.jst.component.nondependencyvalue =/>
< / attributes>
In the my application I have set some jars as project dependency. This jars are added as User Library. As I am running the application in JBoss AS7 and I am using the JSF implementation which is provided by the JBoss server, I have copied those JSF jars from the module and create a new User Library namely JBoss JSF. This library has been used to create JSF 2 Dynamic Web Project in Eclipse. Now when I am exporting it as a WAR file, those jsf jars are automatically being copied and added in /WEB-INF/lib
of the war. I don't want that these files are added as they are already present in the container.
Is there any way to do it?
For more information, this is the content of the .classpath file:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/common"/>
<classpathentry kind="src" path="src/service"/>
<classpathentry kind="src" path="src/web"/>
<classpathentry kind="src" path="src/persistent"/>
<classpathentry kind="src" path="src/dao"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JBoss JSF">
<attributes>
<attribute name="owner.project.facets" value="jst.jsf"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JBoss Servlet"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JBoss log4j"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
The Deployment Assembly of my application:
Try this
- Open Project properties
- Select Deployment Assembly
- Select libraries that you need to exclude from the war file then click Remove . Jars you selected will be removed from the War file
or try to add one more attribute to the .classpath file
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JBoss JSF">
<attributes>
<attribute name="owner.project.facets" value="jst.jsf"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
这篇关于如何排除JAR被添加到WAR文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!