2014-02-18 54 views
0

目標和配置文件我在調試時必須指定已存在的maven項目。請幫助我。以下是我的pom.xml文件,通過這個文件我可以得到配置文件,但我無法知道我們在哪裏指定目標。所以有人請向我解釋我們在哪裏可以找到一個maven項目的目標,以及我們如何在調試已經存在的maven項目的同時使用不同類型的目標和配置文件。請幫我如何在調試Maven項目時瞭解目標和配置文件?

<?xml version="1.0"?> 
<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"> 
    <parent> 
     <groupId>com.n2n.entportal</groupId> 
     <artifactId>entportal-parent</artifactId> 
     <version>6.2.0-RC5</version> 
     <!-- 
     <relativePath>../entportal-parent/pom.xml</relativePath> 
     -->  
    </parent> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.n2n.entportal.portlets</groupId> 
    <artifactId>admin-bootstrap-portlets</artifactId> 
    <packaging>war</packaging> 
    <name>admin-bootstrap-portlet Portlet</name> 
    <!-- <version>6.2.0-RC5</version> --> 
    <properties> 
    </properties> 

    <profiles> 
     <profile> 
      <id>dev-light</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/n2n/dev-light</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 
     <profile> 
      <id>dev</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/n2n/dev</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 
     <profile> 
      <id>demo-qa</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/n2n/demo/qa</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 

     <profile> 
      <id>demo-prod</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/n2n/demo/prod</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 

     <profile> 
      <id>console-qa</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/n2n/console/qa</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 


     <profile> 
      <id>console-prod</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/n2n/console/prod</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 

     <profile> 
      <id>ttu</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/clients/ttu</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 


     <profile> 
      <id>spsu-qa</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/clients/spsu/qa</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 
     <profile> 
      <id>spsu-prod</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/clients/spsu/prod</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 

     <profile> 
      <id>subr-qa</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/clients/subr/qa</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 

     <profile> 
      <id>subr-prod</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/clients/subr/prod</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 

     <profile> 
      <id>smc-prod</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/clients/smc/prod</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 

     <profile> 
      <id>smc-qa</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/clients/smc/qa</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 


     <profile> 
      <id>wit-qa</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/clients/wit/qa</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 
     <profile> 
      <id>wit-prod</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/clients/wit/prod</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 
     <profile> 
      <id>k12demo</id> 
      <build> 
       <resources> 
        <resource> 
         <directory>src/main/resources/n2n/k12demo</directory> 
        </resource> 
        <resource> 
         <directory>src/main/resources/common</directory> 
        </resource> 
       </resources> 
      </build> 
     </profile> 

    </profiles> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>com.liferay.maven.plugins</groupId> 
       <artifactId>liferay-maven-plugin</artifactId> 
       <version>${maven.plugin.version}</version> 
       <configuration> 
        <autoDeployDir>${liferay.auto.deploy.dir}</autoDeployDir> 
        <appServerDeployDir>${liferay.app.server.deploy.dir}</appServerDeployDir> 
        <appServerLibGlobalDir>${liferay.app.server.lib.global.dir}</appServerLibGlobalDir> 
        <appServerPortalDir>${liferay.app.server.portal.dir}</appServerPortalDir> 
        <liferayVersion>${liferay.version}</liferayVersion> 
        <pluginType>portlet</pluginType> 
       </configuration> 
      </plugin> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.5</version> 
       <configuration> 
        <encoding>UTF-8</encoding> 
        <source>1.5</source> 
        <target>1.5</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <artifactId>maven-resources-plugin</artifactId> 
       <version>2.5</version> 
       <configuration> 
        <encoding>UTF-8</encoding> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 

    <dependencies> 
     <dependency> 
      <groupId>com.n2n.entportal</groupId> 
      <artifactId>common</artifactId> 
      <version>0.0.1-SNAPSHOT</version> 
     </dependency> 

     <dependency> 
      <groupId>net.sf.json-lib</groupId> 
      <artifactId>json-lib</artifactId> 
      <version>2.4</version> 
      <classifier>jdk15</classifier> 
      <scope>compile</scope> 
     </dependency> 

     <dependency> 
      <groupId>org.jasig.cas.client</groupId> 
      <artifactId>cas-client-core</artifactId> 
      <version>3.2.0</version> 
     </dependency> 

     <!-- 
     <dependency> 
      <groupId>log4j</groupId> 
      <artifactId>log4j</artifactId> 
      <version>1.2.5</version> 
     </dependency> 
     --> 
     <dependency> 
      <groupId>xml-security</groupId> 
      <artifactId>xmlsec</artifactId> 
      <version>1.3.0</version> 
     </dependency> 

     <dependency> 
      <groupId>org.opensaml</groupId> 
      <artifactId>opensaml</artifactId> 
      <version>1.1</version> 
     </dependency> 

     <dependency> 
      <groupId>jstl</groupId> 
      <artifactId>jstl</artifactId> 
      <version>1.2</version> 
      <!--<scope>provided</scope> --> 
     </dependency> 

    </dependencies> 

    <repositories> 
     <repository> 
      <snapshots> 
       <enabled>false</enabled> 
      </snapshots> 
      <id>central</id> 
      <name>Maven Repository Switchboard</name> 
      <url>http://repo1.maven.org/maven2</url> 
     </repository> 
     <repository> 
      <id>n2ncentral</id> 
      <url>https://m2.n2nservices.com/artifactory/repo</url> 
      <snapshots> 
       <enabled>false</enabled> 
      </snapshots> 
     </repository> 
     <repository> 
      <id>snapshots</id> 
      <url>https://m2.n2nservices.com/artifactory/repo</url> 
      <releases> 
       <enabled>false</enabled> 
      </releases> 
     </repository> 
    </repositories> 
    <pluginRepositories> 
     <pluginRepository> 
      <releases> 
       <updatePolicy>never</updatePolicy> 
      </releases> 
      <snapshots> 
       <enabled>false</enabled> 
      </snapshots> 
      <id>central</id> 
      <name>Maven Plugin Repository</name> 
      <url>http://repo1.maven.org/maven2</url> 
     </pluginRepository> 
    </pluginRepositories> 

</project> 

回答

0

在行家CMD: 要觸發一個輪廓:

mvn groupId:artifactId:goal -P profile-1,profile-2 

選擇特定的環境:

mvn groupId:artifactId:goal -Denvironment=test 

停用輪廓

mvn groupId:artifactId:goal -P !profile-1,!profile-2 

請到雖然這更多的編譯選項對Maven: http://maven.apache.org/guides/introduction/introduction-to-profiles.html

如果你在Eclipse工作 目標,你可以指定clean install 您可以選擇checkboxs的如:Skip TestsDebug Output等。

但默認所有的配置文件將被執行,但如果你需要你也可以指定一個特定的配置文件。