webAppCreator -out MyWebApp com.mycompany.mywebapp.MyWebApp
public static native void methodWithRegularExpression()/*-{ var reg = /^[\\w+/_-]+[=]{0,2}$/ console.log("reg:" + reg) }-*/;
/** * This is the entry point method. */ public void onModuleLoad() { methodWithRegularExpression(); }
<!-- Arguments to gwtc and devmode targets -->
<property name="gwt.args" value="" />
<!-- Configure path to GWT SDK --> <property name="gwt.sdk" location="G:/Google/gwt-2.8.2" />
<path id="project.class.path"> <fileset dir="lib" includes="**/*.jar"/> <pathelement location="war/WEB-INF/classes"/> <pathelement location="${gwt.sdk}/gwt-user.jar"/> <pathelement location="${gwt.sdk}/gwt-dev.jar"/> <pathelement location="${gwt.sdk}/validation-api-1.0.0.GA.jar"/> <pathelement location="${gwt.sdk}/validation-api-1.0.0.GA-sources.jar"/> <fileset dir="war/WEB-INF/lib" includes="**/*.jar"/> <!-- Add any additional non-server libs (such as JUnit) here --> </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" /> <copy todir="war/WEB-INF/lib" file="${gwt.sdk}/gwt-servlet-deps.jar" /> <!-- Add any additional server libs that need to be copied --> </target>
<target name="javac" depends="libs" description="Compile java source to bytecode"> <mkdir dir="war/WEB-INF/classes"/> <javac srcdir="src" includes="**" encoding="utf-8" destdir="war/WEB-INF/classes" source="1.7" target="1.7" 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 (production mode)"> <java failonerror="true" fork="true" classname="com.google.gwt.dev.Compiler" maxmemory="512m"> <classpath> <pathelement location="src"/> <path refid="project.class.path"/> </classpath> <arg line="-war"/> <arg value="war"/> <!-- Additional arguments like -style PRETTY or -logLevel DEBUG --> <arg line="${gwt.args}"/> <arg line="-strict"/> <arg value="com.mycompany.mywebapp.MyWebApp"/> </java> </target>
javac: [javac] G:\Google\MyWebApp\build.xml:34: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds [javac] Compiling 1 source file to G:\Google\MyWebApp\war\WEB-INF\classes
gwtc: [java] 七月 29, 2019 10:31:07 上午 java.util.prefs.WindowsPreferences <init> [java] 警告: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5. [java] Compiling module com.mycompany.mywebapp.MyWebApp [java] Tracing compile failure path for type 'com.mycompany.mywebapp.client.MyWebApp' [java] [ERROR] Errors in 'file:/G:/Google/MyWebApp/src/com/mycompany/mywebapp/client/MyWebApp.java' [java] [ERROR] Line 44: missing ; before statement [java] > var reg = /^[\\w+/_-]+[=]{0,2}$/ [java] > ---------------------------^ [java] Finding entry point classes [java] Tracing compile failure path for type 'com.mycompany.mywebapp.client.MyWebApp' [java] [ERROR] Errors in 'file:/G:/Google/MyWebApp/src/com/mycompany/mywebapp/client/MyWebApp.java' [java] [ERROR] Line 44: missing ; before statement [java] > var reg = /^[\\w+/_-]+[=]{0,2}$/ [java] > ---------------------------^ [java] [ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
BUILD FAILED
var reg = /^[\\w+/_-]+[=]{0,2}$/
var reg = /^[\\w+\/_-]+[=]{0,2}$/