我想将我的 GWT 2.3 应用程序打包到一个 war 文件中,并将其部署在 weblogic 服务器上。我用 ANT http://www.rubiconred.com/blog/build-package-a-gwt-app-to-war-using-ant/找到了这个解决方案。但有一个问题。编译目标抛出一个错误,在我看来 ANT 使用了错误的 Java 版本。但是当我运行时 -> Ant Build... -> JRE 版本是正确的(1.6.0_11)。所以这个问题的解决方案不起作用。而且我还不确定java版本是否是问题所在。
控制台输出如下所示:
Buildfile: C:\projects\logdashboard\LogDashboard\warbuilder.xml
prepare:
compile:
[javac] Compiling 124 source files to C:\projects\logdashboard\LogDashboard\build
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\shared\dto\ApplicationDto.java:22: package javax.validation.constraints does not exist
[javac] import javax.validation.constraints.Pattern;
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\shared\dto\UserDto.java:20: package javax.validation.constraints does not exist
[javac] import javax.validation.constraints.Pattern;
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\ValidatorFactory.java:18: cannot find symbol
[javac] symbol : class Validator
[javac] location: package javax.validation
[javac] import javax.validation.Validator;
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\ValidatorFactory.java:36: cannot access javax.validation.ValidatorFactory
[javac] class file for javax.validation.ValidatorFactory not found
[javac] public class ValidatorFactory extends AbstractGwtValidatorFactory {
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\ValidatorFactory.java:71: cannot find symbol
[javac] symbol : class Validator
[javac] location: class com.roche.research.logdashboard.client.ValidatorFactory
[javac] public interface GwtValidator extends Validator {
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\activity\ApplicationAddPresenter.java:22: cannot find symbol
[javac] symbol : class ConstraintViolation
[javac] location: package javax.validation
[javac] import javax.validation.ConstraintViolation;
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\activity\ApplicationAddPresenter.java:23: cannot find symbol
[javac] symbol : class Validator
[javac] location: package javax.validation
[javac] import javax.validation.Validator;
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\ApplicationAddViewImpl.java:25: cannot find symbol
[javac] symbol : class Validation
[javac] location: package javax.validation
[javac] import javax.validation.Validation;
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\ApplicationEditViewImpl.java:25: cannot find symbol
[javac] symbol : class Validation
[javac] location: package javax.validation
[javac] import javax.validation.Validation;
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\UserAddViewImpl.java:23: cannot find symbol
[javac] symbol : class Validation
[javac] location: package javax.validation
[javac] import javax.validation.Validation;
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\UserEditViewImpl.java:23: cannot find symbol
[javac] symbol : class Validation
[javac] location: package javax.validation
[javac] import javax.validation.Validation;
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\server\domain\logparser\DateUtil.java:23: package com.ibm.icu.text does not exist
[javac] import com.ibm.icu.text.SimpleDateFormat;
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\server\domain\logparser\LogFileUtil.java:22: package org.apache.commons.lang.time does not exist
[javac] import org.apache.commons.lang.time.DateUtils;
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\shared\AutoinjectingRemoteServlet.java:19: package javax.servlet does not exist
[javac] import javax.servlet.ServletConfig;
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\shared\AutoinjectingRemoteServlet.java:20: package javax.servlet does not exist
[javac] import javax.servlet.ServletException;
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\shared\AutoinjectingRemoteServlet.java:38: cannot access javax.servlet.http.HttpServlet
[javac] class file for javax.servlet.http.HttpServlet not found
[javac] public class AutoinjectingRemoteServlet extends RemoteServiceServlet {
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\shared\AutoinjectingRemoteServlet.java:55: cannot find symbol
[javac] symbol : class ServletConfig
[javac] location: class com.roche.research.logdashboard.shared.AutoinjectingRemoteServlet
[javac] public void init(ServletConfig config) throws ServletException {
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\shared\AutoinjectingRemoteServlet.java:55: cannot find symbol
[javac] symbol : class ServletException
[javac] location: class com.roche.research.logdashboard.shared.AutoinjectingRemoteServlet
[javac] public void init(ServletConfig config) throws ServletException {
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\shared\ValidationUtil.java:43: cannot find symbol
[javac] symbol : class ConstraintViolation
[javac] location: class com.roche.research.logdashboard.shared.ValidationUtil<T>
[javac] public String getErrorMessage(Set<ConstraintViolation<T>> violations) {
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\shared\dto\ApplicationDto.java:46: cannot find symbol
[javac] symbol : class Pattern
[javac] location: class com.roche.research.logdashboard.shared.dto.ApplicationDto
[javac] @Pattern(regexp = "^(http|ftp|https){1}://.*$", message = "This is no correct url.")
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\shared\dto\UserDto.java:47: cannot find symbol
[javac] symbol : class Pattern
[javac] location: class com.roche.research.logdashboard.shared.dto.UserDto
[javac] @Pattern(regexp = "^.+\\..+@roche.com$", message = "This is no roche email adresse.")
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\ValidatorFactory.java:40: method does not override or implement a method from a supertype
[javac] @Override
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\activity\ApplicationAddPresenter.java:118: cannot find symbol
[javac] symbol : class Validator
[javac] location: class com.roche.research.logdashboard.client.activity.ApplicationAddPresenter
[javac] Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\activity\ApplicationAddPresenter.java:119: cannot find symbol
[javac] symbol : class ConstraintViolation
[javac] location: class com.roche.research.logdashboard.client.activity.ApplicationAddPresenter
[javac] Set<ConstraintViolation<ApplicationDto>> violations = validator.validate(applicationDto);
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\ApplicationAddViewImpl.java:174: cannot find symbol
[javac] symbol : class Validator
[javac] location: class com.roche.research.logdashboard.client.view.ApplicationAddViewImpl
[javac] Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\ApplicationAddViewImpl.java:174: cannot find symbol
[javac] symbol : variable Validation
[javac] location: class com.roche.research.logdashboard.client.view.ApplicationAddViewImpl
[javac] Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\ApplicationAddViewImpl.java:175: cannot find symbol
[javac] symbol : class ConstraintViolation
[javac] location: class com.roche.research.logdashboard.client.view.ApplicationAddViewImpl
[javac] Set<ConstraintViolation<ApplicationDto>> violations = validator.validateProperty(application, "url");
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\ApplicationEditViewImpl.java:182: cannot find symbol
[javac] symbol : class Validator
[javac] location: class com.roche.research.logdashboard.client.view.ApplicationEditViewImpl
[javac] Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\ApplicationEditViewImpl.java:182: cannot find symbol
[javac] symbol : variable Validation
[javac] location: class com.roche.research.logdashboard.client.view.ApplicationEditViewImpl
[javac] Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\ApplicationEditViewImpl.java:183: cannot find symbol
[javac] symbol : class ConstraintViolation
[javac] location: class com.roche.research.logdashboard.client.view.ApplicationEditViewImpl
[javac] Set<ConstraintViolation<ApplicationDto>> violations = validator.validateProperty(application, "url");
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\UserAddViewImpl.java:149: cannot find symbol
[javac] symbol : class Validator
[javac] location: class com.roche.research.logdashboard.client.view.UserAddViewImpl
[javac] Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\UserAddViewImpl.java:149: cannot find symbol
[javac] symbol : variable Validation
[javac] location: class com.roche.research.logdashboard.client.view.UserAddViewImpl
[javac] Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\UserAddViewImpl.java:150: cannot find symbol
[javac] symbol : class ConstraintViolation
[javac] location: class com.roche.research.logdashboard.client.view.UserAddViewImpl
[javac] Set<ConstraintViolation<UserDto>> violations = validator.validateProperty(user, "email");
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\UserEditViewImpl.java:155: cannot find symbol
[javac] symbol : class Validator
[javac] location: class com.roche.research.logdashboard.client.view.UserEditViewImpl
[javac] Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\UserEditViewImpl.java:155: cannot find symbol
[javac] symbol : variable Validation
[javac] location: class com.roche.research.logdashboard.client.view.UserEditViewImpl
[javac] Validator validator = Validation.buildDefaultValidatorFactory().getValidator();
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\client\view\UserEditViewImpl.java:156: cannot find symbol
[javac] symbol : class ConstraintViolation
[javac] location: class com.roche.research.logdashboard.client.view.UserEditViewImpl
[javac] Set<ConstraintViolation<UserDto>> violations = validator.validateProperty(user, "email");
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\server\domain\logparser\DateUtil.java:50: cannot find symbol
[javac] symbol : class SimpleDateFormat
[javac] location: class com.roche.research.logdashboard.server.domain.logparser.DateUtil
[javac] SimpleDateFormat format = new SimpleDateFormat(ServerProp.get().getProperty("LOGFILE_EXTENSION_DATE_PATTERN"));
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\server\domain\logparser\DateUtil.java:50: cannot find symbol
[javac] symbol : class SimpleDateFormat
[javac] location: class com.roche.research.logdashboard.server.domain.logparser.DateUtil
[javac] SimpleDateFormat format = new SimpleDateFormat(ServerProp.get().getProperty("LOGFILE_EXTENSION_DATE_PATTERN"));
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\server\domain\logparser\DateUtil.java:67: cannot find symbol
[javac] symbol : class SimpleDateFormat
[javac] location: class com.roche.research.logdashboard.server.domain.logparser.DateUtil
[javac] SimpleDateFormat format = new SimpleDateFormat(ServerProp.get().getProperty("LOGFILE_EXTENSION_DATE_PATTERN"));
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\server\domain\logparser\DateUtil.java:67: cannot find symbol
[javac] symbol : class SimpleDateFormat
[javac] location: class com.roche.research.logdashboard.server.domain.logparser.DateUtil
[javac] SimpleDateFormat format = new SimpleDateFormat(ServerProp.get().getProperty("LOGFILE_EXTENSION_DATE_PATTERN"));
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\server\domain\logparser\DateUtil.java:78: cannot find symbol
[javac] symbol : class SimpleDateFormat
[javac] location: class com.roche.research.logdashboard.server.domain.logparser.DateUtil
[javac] SimpleDateFormat format = new SimpleDateFormat(ServerProp.get().getProperty("LOGLINE_DATE_PATTERN"));
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\server\domain\logparser\DateUtil.java:78: cannot find symbol
[javac] symbol : class SimpleDateFormat
[javac] location: class com.roche.research.logdashboard.server.domain.logparser.DateUtil
[javac] SimpleDateFormat format = new SimpleDateFormat(ServerProp.get().getProperty("LOGLINE_DATE_PATTERN"));
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\server\domain\logparser\DateUtil.java:95: cannot find symbol
[javac] symbol : class SimpleDateFormat
[javac] location: class com.roche.research.logdashboard.server.domain.logparser.DateUtil
[javac] SimpleDateFormat format = new SimpleDateFormat(ServerProp.get().getProperty("LOGLINE_DATE_PATTERN"));
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\server\domain\logparser\DateUtil.java:95: cannot find symbol
[javac] symbol : class SimpleDateFormat
[javac] location: class com.roche.research.logdashboard.server.domain.logparser.DateUtil
[javac] SimpleDateFormat format = new SimpleDateFormat(ServerProp.get().getProperty("LOGLINE_DATE_PATTERN"));
[javac] ^
[javac] C:\projects\logdashboard\LogDashboard\src\main\java\com\roche\research\logdashboard\server\domain\logparser\LogFileUtil.java:65: cannot find symbol
[javac] symbol : variable DateUtils
[javac] location: class com.roche.research.logdashboard.server.domain.logparser.LogFileUtil
[javac] || DateUtils.isSameDay(logFile.getDate(), since)) {
[javac] ^
BUILD FAILED
C:\projects\logdashboard\LogDashboard\warbuilder.xml:31: Compile failed; see the compiler error output for details.
Total time: 7 seconds
所以我的问题是:
来自ant的Java版本是问题吗?
或者:
有没有更简单的方法将 GWT 应用程序打包到 war 文件,然后是 ant 脚本?我尝试了一些东西,但下确实有效。