首页 > 代码库 > pom.xml 样例

pom.xml 样例

  

<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://maven.apache.org/POM/4.0.0"
         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>**</groupId>
    <artifactId>**</artifactId>
    <packaging>pom</packaging>
    <version>1.0</version>

    <modules>
        <module>**</module>
        <module>**</module>
    </modules>

    <description>**</description>

    <properties>
        <project.build.sourceEncoding>utf-8</project.build.sourceEncoding>
        <jdk.version>1.8</jdk.version>
        <slf4j.api.version>1.7.14</slf4j.api.version>
        <log4j.slf4j.impl.version>2.5</log4j.slf4j.impl.version>
        <log4j.core.version>2.5</log4j.core.version>
        <junit.version>4.12</junit.version>
    </properties>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <configuration>
                        <source>${jdk.version}</source>
                        <target>${jdk.version}</target>
                        <compilerVersion>${jdk.version}</compilerVersion>
                    </configuration>
                </plugin>

                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>sonar-maven-plugin</artifactId>
                    <version>3.0.1</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>
        <profile>
            <id>test</id>
            <properties>
                <build.profile>test</build.profile>
                <host.nexus.central>
                    http://host:port/nexus/content/repositories/central
                </host.nexus.central>
                <host.nexus.release>
                    http://host:port/nexus/content/repositories/releases
                </host.nexus.release>
                <host.nexus.public>
                    http://host:port/nexus/content/repositories/public
                </host.nexus.public>
                <host.nexus.snapshots>
                    http://host:port/nexus/content/repositories/snapshots
                </host.nexus.snapshots>
            </properties>
            <build>
                <filters>
                    <filter>src/profiles/${build.profile}/config.properties</filter>
                </filters>
                <resources>
                    <resource>
                        <directory>src/main/resources</directory>
                        <filtering>true</filtering>
                    </resource>
                </resources>
            </build>
        </profile>

        <profile>
            <id>dev</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <build.profile>dev</build.profile>
                <host.nexus.central>
                    http://host:port/nexus/content/repositories/central
                </host.nexus.central>
                <host.nexus.release>
                    http://host:port/nexus/content/repositories/releases
                </host.nexus.release>
                <host.nexus.public>
                    http://host:port/nexus/content/repositories/public
                </host.nexus.public>
                <host.nexus.snapshots>
                    http://host:port/nexus/content/repositories/snapshots
                </host.nexus.snapshots>
            </properties>
            <build>
                <filters>
                    <filter>src/profiles/${build.profile}/config.properties</filter>
                </filters>
                <resources>
                    <resource>
                        <directory>src/main/resources</directory>
                        <filtering>true</filtering>
                    </resource>
                </resources>
            </build>
        </profile>

        <profile>
            <id>prod</id>
            <properties>
                <build.profile>prod</build.profile>
                <host.nexus.central>
                    http://host:port/nexus/content/repositories/central
                </host.nexus.central>
                <host.nexus.release>
                    http://host:port/nexus/content/repositories/releases
                </host.nexus.release>
                <host.nexus.public>
                    http://host:port/nexus/content/repositories/public
                </host.nexus.public>
                <host.nexus.snapshots>
                    http://host:port/nexus/content/repositories/snapshots
                </host.nexus.snapshots>
            </properties>
            <build>
                <filters>
                    <filter>src/profiles/${build.profile}/config.properties</filter>
                </filters>
                <resources>
                    <resource>
                        <directory>src/main/resources</directory>
                        <filtering>true</filtering>
                    </resource>
                </resources>
            </build>
        </profile>
    </profiles>

    <repositories>
        <repository>
            <id>nexus-central</id>
            <name>nexus central</name>
            <url>${host.nexus.central}</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>nexus-release</id>
            <name>nexus release</name>
            <url>${host.nexus.release}</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>

        <repository>
            <id>nexus-snapshots</id>
            <name>nexus snapshots</name>
            <url>${host.nexus.snapshots}</url>
            <releases>
                <enabled>false</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.api.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-slf4j-impl</artifactId>
            <version>${log4j.slf4j.impl.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>${log4j.core.version}</version>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

</project>

 

pom.xml 样例