Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在gwt中将JAR添加到ant类路径_Gwt_Ant_Classpath - Fatal编程技术网

在gwt中将JAR添加到ant类路径

在gwt中将JAR添加到ant类路径,gwt,ant,classpath,Gwt,Ant,Classpath,我是gwt和ant的新手。早些时候,我正在使用maven/SpringPlayFramework/sbt 我想在我的gwt项目中添加一些外部JAR,如: GWT3自举 冬眠 mysql连接器等 我已将JAR添加到项目中的lib文件夹中: -gwtbootstrap3-0.9.1.jar -gwtbootstrap3-extras-0.9.1.jar 但我在控制台上遇到一个错误: Runing CodeServer with parameters: [-noprecompile, -port,

我是gwt和ant的新手。早些时候,我正在使用maven/SpringPlayFramework/sbt

我想在我的gwt项目中添加一些外部JAR,如:

  • GWT3自举
  • 冬眠
  • mysql连接器等
我已将JAR添加到项目中的
lib
文件夹中: -gwtbootstrap3-0.9.1.jar -gwtbootstrap3-extras-0.9.1.jar

但我在控制台上遇到一个错误:

Runing CodeServer with parameters: [-noprecompile, -port, 42543, -sourceLevel, 1.7, -bindAddress, 127.0.0.1, -launcherDir, /home/danielo/eclipseGwt/StockWatcher/war, -logLevel, INFO, com.google.gwt.sample.stockwatcher.StockWatcher]
Super Dev Mode starting up
   workDir: /tmp/gwt-codeserver-6966154251496651044.tmp
   Loading inherited module 'com.google.gwt.sample.stockwatcher.StockWatcher'
      Loading inherited module 'com.github.gwtbootstrap.Bootstrap'
         [ERROR] Unable to find 'com/github/gwtbootstrap/Bootstrap.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
Loading modules
   com.google.gwt.sample.stockwatcher.StockWatcher
      Loading inherited module 'com.google.gwt.sample.stockwatcher.StockWatcher'
         Loading inherited module 'com.github.gwtbootstrap.Bootstrap'
            [ERROR] Unable to find 'com/github/gwtbootstrap/Bootstrap.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] shell failed in doStartup method
MyProject.gwt.xml:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 1.6.2//EN" "http://google-web-toolkit.googlecode.com/svn/tags/1.6.2/distro-source/core/src/gwt-module.dtd">
<module rename-to='stockwatcher'>
    <!-- Inherit the core Web Toolkit stuff. -->
    <inherits name='com.google.gwt.user.User' />

    <!-- Inherit the default GWT style sheet. You can change -->
    <!-- the theme of your GWT application by uncommenting -->
    <!-- any one of the following lines. -->
    <inherits name='com.google.gwt.user.theme.standard.Standard' />
    <inherits name="com.github.gwtbootstrap.Bootstrap" />
    <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
    <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->

    <!-- Other module inherits -->

    <!-- Specify the app entry point class. -->
    <entry-point class='com.google.gwt.sample.stockwatcher.client.StockWatcher' />
</module>

build.xml:

<?xml version="1.0" encoding="utf-8" ?>
<project name="StockWatcher" default="build" basedir=".">
    <!-- Configure path to GWT SDK -->
    <property name="gwt.sdk" location="/path/to/gwt.sdk" />

    <path id="project.class.path">
        <pathelement location="war/WEB-INF/classes" />
        <pathelement location="${gwt.sdk}/gwt-user.jar" />
        <fileset dir="${gwt.sdk}" includes="gwt-dev*.jar" />
        <!-- Add any additional non-server libs (such as JUnit) -->
        <fileset dir="war/WEB-INF/lib" includes="**/*.jar" />
    </path>

    <target name="libs" description="Copy libs to WEB-INF/lib">
        <mkdir dir="war/WEB-INF/lib" />
        <copy todir="war/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet.jar" />
        <!-- Add any additional server libs that need to be copied -->
    </target>

    <target name="javac" depends="libs" description="Compile java source">
        <mkdir dir="war/WEB-INF/classes" />
        <javac srcdir="src" includes="**" encoding="utf-8" destdir="war/WEB-INF/classes" source="1.5" target="1.5" nowarn="true" debug="true" debuglevel="lines,vars,source">
            <classpath refid="project.class.path" />
        </javac>
        <copy todir="war/WEB-INF/classes">
            <fileset dir="src" excludes="**/*.java" />
        </copy>
    </target>

    <target name="gwtc" depends="javac" description="GWT compile to JavaScript">
        <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler">
            <classpath>
                <pathelement location="src" />
                <path refid="project.class.path" />
            </classpath>
            <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
            <jvmarg value="-Xmx256M" />
            <!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
            <arg value="com.google.gwt.sample.stockwatcher.StockWatcher" />
        </java>
    </target>

    <target name="devmode" depends="javac" description="Run development mode">
        <java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
            <classpath>
                <pathelement location="src" />
                <path refid="project.class.path" />
            </classpath>
            <jvmarg value="-Xmx256M" />
            <arg value="-startupUrl" />
            <arg value="StockWatcher.html" />
            <!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
            <arg value="com.google.gwt.sample.stockwatcher.StockWatcher" />
        </java>
    </target>

    <target name="javac.tests" depends="javac" description="Compiles test code">
        <javac srcdir="test" includes="**" encoding="utf-8" source="1.5" target="1.5" nowarn="true" debug="true" debuglevel="lines,vars,source">
            <classpath location="path_to_the_junit_jar" />
            <classpath refid="project.class.path" />
        </javac>
    </target>

    <target name="test.dev" depends="javac.tests" description="Run development mode tests">
        <mkdir dir="reports/htmlunit.dev" />
        <junit fork="yes" printsummary="yes" haltonfailure="yes">
            <jvmarg line="-Xmx256m" />
            <sysproperty key="gwt.args" value="-logLevel WARN" />
            <sysproperty key="java.awt.headless" value="true" />
            <classpath>
                <pathelement location="src" />
                <pathelement location="test" />
                <path refid="project.class.path" />
                <pathelement location="path_to_the_junit_jar" />
            </classpath>
            <batchtest todir="reports/htmlunit.dev">
                <fileset dir="test">
                    <include name="**/*Test.java" />
                </fileset>
            </batchtest>
            <formatter type="plain" />
            <formatter type="xml" />
        </junit>
    </target>

    <target name="test.prod" depends="javac.tests" description="Run production mode tests">
        <mkdir dir="reports/htmlunit.prod" />
        <junit fork="yes" printsummary="yes" haltonfailure="yes">
            <jvmarg line="-Xmx256m" />
            <sysproperty key="gwt.args" value="-prod -logLevel WARN -out www-test" />
            <sysproperty key="java.awt.headless" value="true" />
            <classpath>
                <pathelement location="src" />
                <pathelement location="test" />
                <path refid="project.class.path" />
                <pathelement location="path_to_the_junit_jar" />
            </classpath>
            <batchtest todir="reports/htmlunit.prod">
                <fileset dir="test">
                    <include name="**/*Test.java" />
                </fileset>
            </batchtest>
            <formatter type="plain" />
            <formatter type="xml" />
        </junit>
    </target>

    <target name="test" description="Run development and production mode tests">
        <antcall target="test.dev" />
        <antcall target="test.prod" />
    </target>

    <target name="hosted" depends="devmode" description="Run development mode (NOTE: the 'hosted' target is deprecated)" />

    <target name="build" depends="gwtc" description="Build this project" />

    <target name="war" depends="build" description="Create a war file">
        <zip destfile="StockWatcher.war" basedir="war" />
    </target>

    <target name="clean" description="Cleans this project">
        <delete dir="war/WEB-INF/classes" failonerror="false" />
        <delete dir="war/stockwatcher" failonerror="false" />
    </target>

</project>

我还尝试在EclipseRMB中的项目->属性->Java构建路径->库选项卡->添加外部JAR中添加这个JAR

但这对我没有帮助

请给我一些帮助


我已经搜索了很多论坛帖子,但是我自己无法解决这个问题。

只要使用gwtBootstrap3,你就必须下载jar

然后必须在build.xml中声明pathelement

<path id="project.class.path">
        <pathelement location="war/WEB-INF/classes" />
        <pathelement location="${gwt.sdk}/gwt-user.jar" />
        <pathelement location="yourpathtojar/gwtbootstrap3-0.9.1.jar" />
        <fileset dir="${gwt.sdk}" includes="gwt-dev*.jar" />
        <!-- Add any additional non-server libs (such as JUnit) -->
        <fileset dir="war/WEB-INF/lib" includes="**/*.jar" />
    </path>


如果您使用maven项目,您可以遵循

只需使用gwtBootstrap3,您必须下载jar

然后必须在build.xml中声明pathelement

<path id="project.class.path">
        <pathelement location="war/WEB-INF/classes" />
        <pathelement location="${gwt.sdk}/gwt-user.jar" />
        <pathelement location="yourpathtojar/gwtbootstrap3-0.9.1.jar" />
        <fileset dir="${gwt.sdk}" includes="gwt-dev*.jar" />
        <!-- Add any additional non-server libs (such as JUnit) -->
        <fileset dir="war/WEB-INF/lib" includes="**/*.jar" />
    </path>


如果您使用maven项目,您可以遵循

谢谢。但我已经放弃了。我换成了maven,谢谢。但我已经放弃了。我换成了maven。