0

Grails コマンド 'war' を実行して war ファイルを作成すると、war ファイルは完全に実行されます。

それがmavenになると、まったく機能しません!「クリーンパッケージ」を実行してプロジェクトをビルドし、すべてのテストをスキップしました(これが戦争に影響するかどうかはわかりません)

warファイルはターゲットディレクトリに生成されますが、warファイルのサイズがgrailsコマンドで生成されたものと異なることに気付きました。また、maven で生成された war ファイルを tomcat サーバーにデプロイすると、実行できません。

もう 1 つの質問は、pom.xml に maven-war を追加する必要があるかどうかです。ゴールを追加しなくても war ファイルが作成されるため、ゴールの設定との違いは何ですか?

私のpomファイル:

<properties>
    <grails.version>2.1.1</grails.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.grails</groupId>
        <artifactId>grails-dependencies</artifactId>
        <version>${grails.version}</version>
        <type>pom</type>
    </dependency>
     <dependency>
        <groupId>org.grails</groupId>
        <artifactId>grails-test</artifactId>
        <version>${grails.version}</version>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.grails</groupId>
        <artifactId>grails-plugin-testing</artifactId>
        <version>${grails.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>tomcat</artifactId>
        <version>${grails.version}</version>
        <scope>provided</scope>
        <type>zip</type>
    </dependency>
    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>cache</artifactId>
        <version>1.0.1</version>
        <scope>compile</scope>
        <type>zip</type>
    </dependency>
   <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>database-migration</artifactId>
        <version>1.3.2</version>
        <scope>runtime</scope>
        <type>zip</type>
    </dependency>
      <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>joda-time</artifactId>
        <version>1.4</version>
        <scope>runtime</scope>
        <type>zip</type>
    </dependency> 
    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>hibernate</artifactId>
        <version>${grails.version}</version>
        <scope>runtime</scope>
        <type>zip</type>
    </dependency>
    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>jquery-ui</artifactId>
        <version>1.8.24</version>
        <scope>runtime</scope>
        <type>zip</type>
    </dependency>
    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>jquery</artifactId>
        <version>1.8.0</version>
        <scope>runtime</scope>
        <type>zip</type>
    </dependency>
    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>resources</artifactId>
        <version>1.1.6</version>
        <scope>runtime</scope>
        <type>zip</type>
    </dependency>
    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>webxml</artifactId>
        <version>1.4.1</version>
        <scope>provided</scope>
        <type>zip</type>
    </dependency>
    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>spring-security-core</artifactId>
        <version>1.2.7.3</version>
        <scope>provided</scope>
        <type>zip</type>
    </dependency>
    <dependency>
        <groupId>org.grails.plugins</groupId>
        <artifactId>spring-security-ldap</artifactId>
        <version>1.0.6</version>
        <scope>provided</scope>
        <type>zip</type>
    </dependency>
    <!--<dependency>-->
        <!--<groupId>com.rbccm.erebus</groupId>-->
        <!--<artifactId>erebus</artifactId>-->
        <!--<version>4.1.1-SNAPSHOT</version>-->
    <!--</dependency>--> 
</dependencies>
<build>
    <pluginManagement/>
    <plugins>
        <!-- Disables the Maven surefire plugin for Grails applications, as we have our own test runner -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <skip>true</skip>
            </configuration>
            <executions>
                <execution>
                    <id>surefire-it</id>
                    <configuration>
                        <skip>false</skip>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-clean-plugin</artifactId>
            <version>2.4.1</version>
            <configuration>
                <filesets>
                    <fileset>
                        <directory>plugins</directory>
                        <includes>
                            <include>**/*</include>
                        </includes>
                        <followSymlinks>false</followSymlinks>
                    </fileset>
                </filesets>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.grails</groupId>
            <artifactId>grails-maven-plugin</artifactId>
            <version>${grails.version}</version>
            <configuration>
                <!-- Whether for Fork a JVM to run Grails commands -->
                 <skipTests>true</skipTests>
                <fork>true</fork>
            </configuration>
            <extensions>true</extensions>
            <executions>
            <execution>
                <goals>
                    <goal>clean</goal>
                    <goal>maven-war</goal>
                </goals>
            </execution>
        </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.4</version>
            <executions>
                <execution>
                 <!-- fix for grails bug http://jira.grails.org/browse/MAVEN-1 -->
                    <id>recopy-resources-after-grails</id>
                    <phase>package</phase>
                    <goals>
                        <goal>resources</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<repositories>
    <repository>
        <id>grails</id>
        <name>grails</name>
        <url>http://repo.grails.org/grails/core</url>
    </repository>
    <repository>
        <id>grails-plugins</id>
        <name>grails-plugins</name>
        <url>http://repo.grails.org/grails/plugins</url>
    </repository>
</repositories>
<profiles>
    <profile>
        <id>tools</id>
        <activation>
            <property>
                <name>java.vendor</name>
                <value>Sun Microsystems Inc.</value>
            </property>
        </activation>
        <dependencies>
            <dependency>
                <groupId>com.sun</groupId>
                <artifactId>tools</artifactId>
                <version>${java.version}</version>
                <scope>system</scope>
                <systemPath>${java.home}/../lib/tools.jar</systemPath>
            </dependency>
        </dependencies>
    </profile>
</profiles>

4

1 に答える 1

0

jar の依存関係を見逃していたことが判明したため、war ファイルを実行できません

于 2013-02-19T11:57:14.847 に答える