先说下,我用的是uportal3.1.2版本,SVN上的项目是以ant和maven为基础的,包括初始化,构建,部署等等。
可是我没找到运行,或是以debug方式运行的target。
就算是部署到tomcat上,也要手动去tomcat目录下启动服务,跟IDE是完全脱离的,这样就带来个问题,我如何调试程序?
源码对于IDE来说只是一个普通的Java工程,所以不会帮你部署,所以最好的方式就是将源码构建成WEB项目的结构,uportal里面有这种命令吗?
如果没有,那请问,您是如何进行二次开发,debug的呢?小弟比较没有经验,还请大家帮助

解决方案 »

  1.   

    那看你的Eclipse插件丰富不丰富了,原来用了一款企业IDE Eclipse,也是基于ANT的。上去点,部署调试就可以了!想要调试就要看看你的项目是什么形式,web就要web工程,启动容器加断点直接调试就行,之前要把部署的依赖包放入类路径。如下是部署。多多试验就可以了。 <target name="war" depends="javac" description="Builds the Web application .war file.">
    <war warfile="webapp.war" webxml="./WEB-INF/web.xml">
    <fileset dir="." includes="**/*.css" />
    <fileset dir="." includes="**/*.html" />
    <fileset dir="." includes="**/*.jsp" />
    <fileset dir="." includes="**/*.class" excludes="**/WEB-INF/classes/**/*.class"/>
    <fileset dir="." includes="**/*.jar" excludes="**/WEB-INF/lib/**/*.jar"/>
    <fileset dir="." includes="**/WEB-INF/classes/**/*.java"/>
    <fileset dir="." includes="**/*.gif" />
    <fileset dir="." includes="**/*.GIF" />
    <fileset dir="." includes="**/*.png" />
    <fileset dir="." includes="**/*.jrxml" />
    <classes dir="./WEB-INF/classes/">
    <include name="**/*.class" />
    </classes>
    <lib dir="./WEB-INF/lib/">
    <include name="*.jar" />
    </lib>
    </war>
    </target>
      

  2.   

    恩,像uportal,它里面也有部署
     <target name="deploy-ear" depends="checkForTomcat" description="Deploy uPortal and dependent libraries and portlets to the servlet container">
            <uportal-ant-tasks-macro>
                <typedef resource="org/jasig/portal/ant/antlib.xml" uri="urn:up-util-ant">
                    <classpath refid="uportal-ant-tasks-full.classpath" />
                </typedef>            <uportal-ear-macro>
                    <echo message="   extractWars=${extractWars}" />
                    <echo message="removeExisting=${removeExisting}" />
                    <echo message="   cleanShared=${cleanShared}" />
                        
                    <if>
                        <equals arg1="${cleanShared}" arg2="true" />
                        <then>
                            <antcall target="clean-shared" />
                        </then>
                    </if>                <up:tomcatEarDeploy ear="${uportal-ear.artifact}" catalinaBase="${server.base}" webAppsDir="${server.webapps}" extractWars="${extractWars}" removeExistingDirectories="${removeExisting}" />
                </uportal-ear-macro>
            </uportal-ant-tasks-macro>
        </target>
    我的Eclipse用的是j2ee 3.5版本的ant或者maven有好的支持断点调试的插件吗
      

  3.   

    恩,像uportal,它里面也有部署
     <target name="deploy-ear" depends="checkForTomcat" description="Deploy uPortal and dependent libraries and portlets to the servlet container">
            <uportal-ant-tasks-macro>
                <typedef resource="org/jasig/portal/ant/antlib.xml" uri="urn:up-util-ant">
                    <classpath refid="uportal-ant-tasks-full.classpath" />
                </typedef>            <uportal-ear-macro>
                    <echo message="   extractWars=${extractWars}" />
                    <echo message="removeExisting=${removeExisting}" />
                    <echo message="   cleanShared=${cleanShared}" />
                        
                    <if>
                        <equals arg1="${cleanShared}" arg2="true" />
                        <then>
                            <antcall target="clean-shared" />
                        </then>
                    </if>                <up:tomcatEarDeploy ear="${uportal-ear.artifact}" catalinaBase="${server.base}" webAppsDir="${server.webapps}" extractWars="${extractWars}" removeExistingDirectories="${removeExisting}" />
                </uportal-ear-macro>
            </uportal-ant-tasks-macro>
        </target>
    我的Eclipse用的是j2ee 3.5版本的ant或者maven有好的支持断点调试的插件吗
      

  4.   

    还没解决?
    建立web动态项目,导入启动server,然后debug on server。
      

  5.   


    现在问题是这样,uportal这个开源项目使用maven构建成了一个打包方式为pom的工程,像你说的这样就等于我重构了整个uportal,代价太大,耶鲁不可能发布个无法在Eclipse下面运行的版本,可是就算是用maven运行的话,我在所有pom.xml里面也没找到jetty插件,我又在想是不是用ant呢  如果,可以把uportal构建成web形式的,那当然好,不过这是不太现实的,除非你已经成功这么做出来了
      

  6.   

    uportal源码本身就是web工程只不过是maven工程所以目录结构看上去与以往的不同,
    1,导入后先配置build.properties文件,设定tomcat和maven目录位置
    2,eclipse装好tomcat插件
    3,windows系统需要修改L:\apache-tomcat-6.0.20\bin下的catalina.bat文件加上set CATALINA_OPTS=-server -XX:MaxPermSize=300m -Xmx256m用来设置内存,防止内存溢出,linux系统需要修改L:\apache-tomcat-6.0.20\bin下的catalina.sh文件加上set CATALINA_OPTS='-server -XX:MaxPermSize=300m -Xmx256m'用来设置内存,注意前者设定值时不需要引号,后者需要。
    4,然后使用ant执行build.xml中的initportal,再启动hsql数据库,再在eclipse中启动tomcat即可
    参考文献:http://www.unicon.net/node/1215