Jetty eclipse plugin build.xml 小改动

来源:互联网 发布:mac怎么看cpu型号 编辑:程序博客网 时间:2024/05/22 02:23

 对JETTY闻名已久,确从未用过,最近发现它的确小巧高效,不过ECLIPSE的插件(org.mortbay.jetty.serveradaptor_1.0.4)发布不是很爽,发布的是一个war包,每次改动一下,就重新发布一次,开发效率比较低

稍稍对build.xml做了一下修改,方便调试(其他的服务器的build.xml也可以作类似修改):

文件在plugins/org.mortbay.jetty.serveradaptor_1.0.4/buildfiles目录下:

 

<project name="deployextension"  default="deploy.j2ee.web"  basedir=".">
    <property name="pause.deploy" value="2"/>
    <property name="pause.undeploy" value="2"/>
    <property name="annotationConfig" value="org.mortbay.jetty.annotations.Configuration"/>
    <property name="nonAnnotationConfig" value="org.mortbay.jetty.plus.webapp.Configuration"/>

    <target name="deploy.j2ee.web">
        <echo>
          context Root = ${contextRoot}
          context Path = ${contextPath}
        </echo>
        <!-- if eclipse passes just the name with no leading slash, add one -->
        <condition property="contextPath" value="/${contextRoot}">
            <not><contains string="${contextRoot}" substring="/"/></not>
        </condition>
        <echo>
         After just name test, contextPath=${contextPath}
        </echo>
       
        <!-- if eclipse passes us double slash (ie on linux) use single slash -->
        <condition property="contextPath" value="/">
            <and>
                <equals arg1="${contextRoot}" arg2="//"/>
                <not><isset property="contextPath"/></not>
            </and>
        </condition>
        <echo>
         After double slash test, contextPath=${contextPath}
        </echo>
       
        <!-- if eclipse passes just a single slash (ie on windows), use that -->
        <condition property="contextPath" value="${contextRoot}">
            <and>
                <equals arg1="${contextRoot}" arg2="/"/>
                <not><isset property="contextPath"/></not>
            </and>
        </condition>
       
        <!-- if eclipse passes us a contextPath of form /<whatever>, use that -->
        <condition property="contextPath" value="${contextRoot}">
            <and>
                <contains string="${contextRoot}" substring="/"/>
                <not><isset property="contextPath"/></not>
            </and>
        </condition>
   
        <!-- if still nothing useable, fallback to module name -->
        <condition property="contextPath" value="/${module.name}">
          <not>
            <isset property="contextPath"/>
          </not>
        </condition>
        <echo>
        after third test, contextPath=${contextPath} and module name=${module.name}
        </echo>

        <!-- optionally use annotations -->
        <condition property="useAnnotations" value="${annotationConfig}">
          <istrue value="${supportAnnotations}"/>
        </condition>
        <condition property="useAnnotations" value="${nonAnnotationConfig}">
             <isfalse value="${supportAnnotations}"/>
        </condition>
        <copy todir="${jettyHome}/webapps/${module.name}" verbose="true">
            <fileset dir="${module.dir}"/>
        </copy>

    </target>
    <target name="undeploy.j2ee.web">
        <delete dir="${jettyHome}/webapps/${module.name}" failonerror="false"/>
    </target>
</project>

 

其实只是复制文件夹中的修改过的文件而已。