2012-01-16 54 views
5

我们目前使用MyEclipse在开发过程中将项目部署到Tomcat。我们想转储MyEclipse并切换到WTP。我正在使用Eclipse 3.7。通过WTP将依赖项目部署到Tomcat

我们的项目布局有一个'网络'项目和'模块'项目。

我希望能够让每个项目都有自己的ivy文件,使用IvyDE声明其依赖关系,以创建依赖于这些jar的Eclipse库,并将这些jar部署到WEB-INF/lib以及每个类中的类项目部署到WEB-INF /类。

我试过将'modules'项目声明为“Utility Module”,并将其ivy.xml文件中的jar作为部署程序集的一部分声明为WEB-INF/lib,然后添加'modules'项目到'web'项目的部署程序集,但是我得到的是'web'项目的WEB-INF/lib中的一个名为'modules.jar'的jar,其中包含'modules'项目的jar包( modules.jar)WEB-INF/lib目录。

是否有可能获得WTP从应用结构我要部署的布局我想还是我必须对我的两个项目重新组织成一个部署?如果是这样,我该怎么做?

回答

1

我不知道这是否有用,我完全不理解你的问题。

您可以告诉ivyDe将所有jar下载到特定的目录。

  1. 请选中 “检索...” 框
  2. 把相对路径到你的WEB-INF/lib放到检索模式,如:

    资源/ WEB-INF/lib目录/ [神器] - [型] - [修改] [转]

enter image description here

+0

感谢您抽出宝贵时间来帮助。这并不是我所期待的,我并不真的需要IvyDE来为我做一个解决方案,在本地缓存中引用它们并没有问题,WTP部署将从IvyDE创建的库中部署它们。问题是'modules'项目引用的库将被部署在WTP为'modules'项目创建的jar中,而不是'web'项目的WAR-WEB-INF/lib中。我试图找到一个解决方案,不需要我将'module'项目合并到'web'项目中,只是为了让WTP部署工作。 – Victor 2012-01-25 21:13:08

1

我相信我们有一个类似的配置你是什么难以释怀克设置。确保在“首选项”>“Ivy”>“类路径”窗格中选中了“解决工作区中的依赖关系”。

与下面的设置,增加WarProject到Tomcat的时候,你应该看到WarProject节点上的[+]链接,并扩大它应该显示JarProject节点。发布时,你应该看到JarProject.jar任何广口瓶定义在它的ivy.xml加入wtpwebapps/WarProject/WEB-INF/lib Tomcat的发布目录,这对我来说是在.metadata/.plugins/org.eclipse.wst.server.core/tmp0我的工作区目录下。

JAR项目的.settings/org.eclipse.wst.common.project.facet.core.xml的:

<faceted-project> 
    <fixed facet="jst.java" /> 
    <fixed facet="jst.utility" /> 
    <installed facet="jst.java" version="1.6" /> 
    <installed facet="jst.utility" version="1.0" /> 
</faceted-project> 

JAR项目的.settings/org.eclipse.wst.common.component:

<project-modules id="moduleCoreId" project-version="1.5.0"> 
    <wb-module deploy-name="JarProject"> 
    <wb-resource deploy-path="/" source-path="/src" /> 
    <wb-resource deploy-path="/" source-path="/resources" /> 
    </wb-module> 
</project-modules> 

罐项目的ivy.xml:

<ivy-module 
    version="2.0" 
    xmlns:m="http://ant.apache.org/ivy/maven" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"> 
    <info module="JarProject" organisation="org.whatever" revision="${revision}" /> 
    <configurations> 
     <conf name="local" visibility="private" 
     description="Artifacts necessary for local development and testing" /> 
     <conf name="master" /> 
     <conf name="sources" /> 
    </configurations> 
    <publications> 
     <artifact ext="pom" type="pom" /> 
     <artifact ext="jar" type="jar" conf="master" /> 
     <artifact ext="jar" type="source" conf="sources" m:classifier="sources" /> 
    </publications> 

    <dependencies defaultconfmapping="*->master(default),runtime()"> 
    <dependency org="org.jdom" name="jdom" rev="1.0" conf="master" /> 
    <dependency org="junit" name="junit-dep" rev="4.9" conf="local" /> 
    </dependencies> 
</ivy-module> 

战项目的.settings/org.eclipse.wst.common.project.facet.core。XML:

<faceted-project> 
    <fixed facet="jst.java" /> 
    <fixed facet="jst.web" /> 
    <installed facet="jst.java" version="1.6" /> 
    <installed facet="jst.web" version="2.5" /> 
    <runtime name="Apache Tomcat v6.0" /> 

战项目的.settings/org.eclipse.wst.common.component:

<project-modules id="moduleCoreId" project-version="1.5.0"> 
    <wb-module deploy-name="WarProject"> 
    <property name="context-root" value="WarProject" /> 
    <wb-resource deploy-path="/" source-path="/WebContent" /> 
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/src" /> 
    <wb-resource deploy-path="/WEB-INF/classes" source-path="/resources" /> 
    </wb-module> 
</project-modules> 

战项目的.classpath:

<classpath> 
    <classpathentry kind="output" path="bin" /> 
    <classpathentry kind="src" path="src" /> 
    <classpathentry kind="src" path="resources" /> 
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> 
    <attributes> 
     <attribute name="owner.project.facets" value="jst.java" /> 
    </attributes> 
    </classpathentry> 
    <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0"> 
    <attributes> 
     <attribute name="owner.project.facets" value="jst.web" /> 
    </attributes> 
    </classpathentry> 
    <classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?ivyXmlPath=ivy.xml&amp;confs=local&amp;ivySettingsPath=%24%7Bworkspace_loc%3AWarProject%2Fivysettings.xml%7D&amp;loadSettingsOnDemand=false&amp;propertyFiles=" /> 
    <classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?ivyXmlPath=ivy.xml&amp;confs=master&amp;ivySettingsPath=%24%7Bworkspace_loc%3AWarProject%2Fivysettings.xml%7D&amp;loadSettingsOnDemand=false&amp;propertyFiles="> 
    <attributes> 
     <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib" /> 
    </attributes> 
    </classpathentry> 
    <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container" /> 
</classpath> 

战项目的常春藤.xml:

<ivy-module 
    version="2.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd"> 
    <info module="WarProject" organisation="org.whatever" revision="${revision}" /> 
    <configurations> 
    <conf name="local" visibility="private" 
     description="Artifacts necessary for local development and testing" /> 
    <conf name="master" /> 
    </configurations> 

    <dependencies defaultconfmapping="*->master(default),runtime()"> 
    <dependency org="org.whatever" name="JarProject" rev="latest.integration" changing="true" conf="master" /> 
    <!-- and other dependencies of the war project --> 
    </dependencies> 
</ivy-module> 

我还发现它可以省略org.eclipse.jst.component.dependency属性在常春藤类路径容器中的类路径条目,而是把它添加到org.eclipse.wst.common.component文件是这样的:

<dependent-module deploy-path="/WEB-INF/lib" handle="module:/classpath/con/org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?ivyXmlPath=ivy.xml&amp;confs=master&amp;ivySettingsPath=%24%7Bworkspace_loc%3AWarProject%2Fivysettings.xml%7D&amp;loadSettingsOnDemand=false&amp;propertyFiles="> 
    <dependency-type>consumes</dependency-type> 
</dependent-module> 

但这种替代下,该如果我更改了ivy.xml并运行解决方案,那么部署的webapp并未更新得非常好。此外,对Ivy的URL参数所做的任何更改都需要与这两个文件保持同步,否则将无助于部署程序集。

不知道如何通过UI设置这一切了......

相关问题