Grails 2.5.4 WAR包装错误

时间:2018-03-14 19:02:19

标签: grails war grails-2.0

我正在尝试用grails 2.5.4项目建立一场战争,但我收到了一个错误。

.Error 
|
WAR packaging error: error=2, No such file or directory

这是我运行的命令和完整的跟踪。

grails dev war --plain-output --stacktrace --verbose

Base Directory: /Users/anupshrestha/workspaces/biblio
|Loading Grails 2.5.4
|Configuring classpath
.
|Environment set to development
.................................
|Packaging Grails application
..................................................
|Compiling 4 GSP files for package [biblio]
..
|Compiling 2 GSP files for package [springSecurityCore]
.    [mkdir] Created dir: /Users/anupshrestha/workspaces/biblio/target/work/stage
.
|Building WAR file
     [copy] Copying 406 files to /Users/anupshrestha/workspaces/biblio/target/work/stage
     [copy] Copied 121 empty directories to 2 empty directories under /Users/anupshrestha/workspaces/biblio/target/work/stage
...............    [mkdir] Created dir: /Users/anupshrestha/workspaces/biblio/target/work/stage/plugins/resources-1.2.14
.     [copy] Copying 7 files to /Users/anupshrestha/workspaces/biblio/target/work/stage/plugins/resources-1.2.14
..........     [copy] Copying 5 files to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/grails-app
     [copy] Copied 4 empty directories to 1 empty directory under /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/grails-app
.     [copy] Copying 659 files to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/classes
.     [copy] Copying 1354 files to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/classes
.    [mkdir] Created dir: /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/spring
..     [copy] Copying 3 files to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/classes
.     [copy] Copying 152 files to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/lib
.     [copy] Copying 1 file to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF
.   [delete] Deleting: /Users/anupshrestha/workspaces/biblio/target/work/resources/web.xml
.     [copy] Copying 4 files to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/lib
...[propertyfile] Updating property file: /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/classes/application.properties
    [mkdir] Created dir: /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/mongodb-5.0.12.RELEASE
.     [copy] Copying 1 file to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/mongodb-5.0.12.RELEASE
..    [mkdir] Created dir: /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/cache-1.1.8
.     [copy] Copying 1 file to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/cache-1.1.8
...    [mkdir] Created dir: /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/webxml-1.4.1
.     [copy] Copying 1 file to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/webxml-1.4.1
...    [mkdir] Created dir: /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/resources-1.2.14
.     [copy] Copying 2 files to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/resources-1.2.14
..     [copy] Copying 2 files to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/classes
.    [mkdir] Created dir: /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/spring-security-cas-2.0-RC1
.     [copy] Copying 1 file to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/spring-security-cas-2.0-RC1
...    [mkdir] Created dir: /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/spring-security-core-2.0-RC4
.     [copy] Copying 11 files to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/spring-security-core-2.0-RC4
...    [mkdir] Created dir: /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/spring-security-ldap-2.0.1
.     [copy] Copying 1 file to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/spring-security-ldap-2.0.1
...    [mkdir] Created dir: /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/ldap-0.8.2
.     [copy] Copying 1 file to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/ldap-0.8.2
...    [mkdir] Created dir: /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/xss-sanitizer-0.4.0
.     [copy] Copying 1 file to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/xss-sanitizer-0.4.0
..     [copy] Copying 2 files to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/classes
.    [mkdir] Created dir: /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/quartz-1.0.1
.     [copy] Copying 1 file to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/quartz-1.0.1
...    [mkdir] Created dir: /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/codenarc-0.25.2
.     [copy] Copying 1 file to /Users/anupshrestha/workspaces/biblio/target/work/stage/WEB-INF/plugins/codenarc-0.25.2
....   [delete] Deleting directory /Users/anupshrestha/workspaces/biblio/target/work/stage
.Error 
|
WAR packaging error: error=2, No such file or directory

2 个答案:

答案 0 :(得分:1)

有很多可能性:

  1. 首先尝试重新启动IDE
  2. 未解决?请检查以下步骤:

    当我们运行compile或创建war命令时,它会创建文件并默认将它们存储在项目的工作目录中。默认目录名称为target

    如果我们的项目工作区包含以前创建的战争。它不会自动删除。它会被新的覆盖。

    运行clean命令并检查目标目录的内容。如果您仍然注意到target/work目录仍然存在。 运行clean-all命令,现在检查target/work是否已删除。

    现在尝试创建war

    如果仍然出现问题,则排除导致创建战争的特定类或罐

    希望这有助于你

答案 1 :(得分:0)

我在消息中也遇到类似的错误:

| Error WAR packaging error: /Users/xxx/.grails/2.5.3/projects/my-proyect/resources/grails-app does not exist.

该错误是由删除i18n目录引起的。修复方法是恢复i18n目录并添加一个空的messages.properties文件。

Reference