如何在调试maven项目时了解目标和配置文件?

时间:2014-02-18 16:44:01

标签: eclipse maven maven-2 maven-3 maven-plugin

在目标和配置文件中

在调试时我必须为现有的maven项目指定的内容。请帮助我。以下是我的pom.xml,通过这个文件,我可以得到个人资料,但我无法知道我们在哪里指定目标。所以任何人请解释我在哪里可以找到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>

1 个答案:

答案 0 :(得分:0)

在maven 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 您可以选中以下复选框:Skip Tests Debug Output等。

但默认情况下会执行所有配置文件,但如果需要,您也可以指定一个特定的配置文件。