2012-12-10 65 views
0

我有这样的自定义配置文件一个POM文件:行家:指定包的输出位置

<profile> 
    <id>openshift</id> 
    <build> 
     <finalName>pomtest</finalName> 
     <plugins> 
      <plugin> 
       <artifactId>maven-war-plugin</artifactId> 
       <version>2.1.1</version> 
       <configuration> 
        <outputDirectory>webapps</outputDirectory> 
        <warName>ROOT</warName> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</profile> 

当我执行

mvn war:war -Popenshift 

它正确生成的文件夹的webapps一个

ROOT.war

,但是当我执行

MVN包-Popenshift

它生成的WAR文件在/ home/SAS/Ubuntu的

(Ubuntu是不是一个文件夹,是HT ROOT.war文件的名称)

我怎么能告诉包的输出位置包输出?

-

编辑:我试着用wemu雁,没有运气

以防万一有人发现了它有用,我张贴在这里,它只是产生的POM整个POM文件

通过使用Grails Grails的POM-产生XXX 加上openshift轮廓

-

<?xml version="1.0" encoding="utf-8"?> 
    <project xmlns="http://maven.apache.org/POM/4.0.0" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
     <modelVersion>4.0.0</modelVersion> 
     <groupId>com.pomtest</groupId> 
     <artifactId>pomtest</artifactId> 
     <packaging>grails-app</packaging> 
     <version>0.1</version> 
     <name>pomtest</name> 
     <description>pomtest</description> 

     <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-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.0</version> 
      <scope>compile</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>database-migration</artifactId> 
      <version>1.1</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>hibernate</artifactId> 
      <version>2.1.1</version> 
      <scope>runtime</scope> 
      <type>zip</type> 
     </dependency> 

     </dependencies> 

     <build> 
      <!-- trying to set output to webapps/ROOT.war... with no luch so far --> 
      <directory>${project.basedir}/webapps</directory> 
      <outputDirectory>${basedir}/webapps</outputDirectory> 
      <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> 
          <phase>integration-test</phase> 
          <goals> 
           <goal>test</goal> 
          </goals> 
          <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 --> 
         <fork>true</fork> 
        </configuration> 
        <extensions>true</extensions> 
       </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> 

      <profile> 
       <id>openshift</id> 
       <build> 
        <finalName>pomtest</finalName> 
        <plugins> 
         <plugin> 
          <artifactId>maven-war-plugin</artifactId> 
          <version>2.1.1</version> 
          <configuration> 
           <outputDirectory>webapps</outputDirectory> 
           <warName>ROOT</warName> 
          </configuration> 
         </plugin> 
        </plugins> 
       </build> 
      </profile> 

     </profiles> 
    </project> 

-

回答

2

我认为你需要重新配置build.directory文件夹:

<build> 
    <directory>${project.basedir}/target</directory> 
</build> 

请注意,并非所有的目录可以配置文件中被改变:http://maven.apache.org/pom.html#Directories

但它可能是不够使用可用的属性或自己的属性http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide来配置构建以按照您希望的方式工作。

warName的默认值已经是:$ {project.build.finalName} - 所以不是在你的例子中使用pomtest,你也可以在那里使用ROOT。 为什么最终在“/ home/sas/Ubuntu”中最终只能从插件配置中得知。

关于 werner

+0

非常感谢您的回复,werner。我试着用你所说的话,但没有运气。我发布了整个pom文件。 – opensas