Grails2.5.4 WAR打包错误

Grails2.5.4 WAR打包错误,grails,war,grails-2.0,Grails,War,Grails 2.0,我试图从Grails2.5.4项目中构建一个war,但我遇到了一个错误 .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 |C

我试图从Grails2.5.4项目中构建一个war,但我遇到了一个错误

.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

有许多可能性:

  • 首先尝试重新启动IDE
  • 没有解决?检查以下步骤:

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

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

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

    现在尝试创建
    war

    如果仍然存在问题,则排除导致战争的特定类或JAR


    希望此帮助是您的

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

    | Error WAR packaging error: /Users/xxx/.grails/2.5.3/projects/my-proyect/resources/grails-app does not exist.
    
    该错误是由删除i18n目录引起的。修复方法是重新安装i18n目录并添加一个空messages.properties文件


    我仍然了解这个问题。我不明白为什么War脚本在构建War之前要删除暂存目录?@anupshrestha您是否已使用
    grails prod War
    进行了检查?