2013-02-18 4 views
0

Я могу создать военный файл, выполнив команду Grails «war», и файл войны работает отлично.Интеграция Grails и Maven: создание файла войны с помощью maven

, когда дело доходит до maven, это совсем не работает! Я построил проект, выполнив «чистый пакет» и пропустив все тесты (не знаю, повлияет ли это на войну)

Файл войны создается в целевой директории, но я заметил, что размер файла войны отличное от того, которое генерируется командой grails. Кроме того, когда я развернул файл сгенерированный войной maven на сервер tomcat, он не может работать.

Другой вопрос: мне нужно добавить maven-war в pom.xml? Потому что, если я не добавлю цели, она по-прежнему будет создавать военный файл, какая разница с настройкой цели?

мой файл ПОМ:

<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> 

ответ

0

Я полагаю, что я пропустил баночку зависимость, поэтому война файл не может запустить

Смежные вопросы