码迷,mamicode.com
首页 > 其他好文 > 详细

maven deploy

时间:2014-08-27 14:31:08      阅读:2264      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   java   io   文件   ar   

 settings.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

  <localRepository>E:\maven_repository</localRepository>

  <pluginGroups>

  </pluginGroups>

  <proxies>

  </proxies>

 <!-- 设置发布时的用户名 -->
 <servers>
     <server>
         <id> releases </id>
        <username>admin</username>
        <password>admin123</password>
    </server>
    <server>
        <id> snapshots </id>
        <username>admin</username>
        <password>admin123</password>
 </server>
 </servers>

 <mirrors>
     <mirror>
         <!--此处配置所有的构建均从私有仓库中下载 *代表所有,也可以写central -->
         <id>nexus</id>
         <mirrorOf>*</mirrorOf>
         <url>http://localhost:8081/nexus/content/groups/public</url>
     </mirror>
 </mirrors>

<profiles>
     <profile>
         <id>nexus</id>
         <!-- 所有请求均通过镜像 -->
         <repositories>
             <repository>
                 <id>central</id>
                 <url>http://central</url>
                 <releases><enabled>true</enabled></releases>
                  <snapshots><enabled>true</enabled></snapshots>
             </repository>
         </repositories>
         <pluginRepositories>
             <pluginRepository>
                 <id>central</id>
                 <url>http://central</url>
                 <releases><enabled>true</enabled></releases>
                 <snapshots><enabled>true</enabled></snapshots>
             </pluginRepository>
         </pluginRepositories>
     </profile>
 </profiles>

<activeProfiles>
 <!--make the profile active all the time -->
 <activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>

 pom.xml文件

<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.mzj</groupId>
    <artifactId>practice</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>practice Maven Webapp</name>
    <url>http://maven.apache.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <spring.version>3.2.8.RELEASE</spring.version>
        <mina.version>2.0.7</mina.version>
        <netty.version>4.0.23.Final</netty.version>
        <tomcat.version>7.0.53</tomcat.version>
    </properties>

    <distributionManagement>
        <repository>
            <id>releases</id>
            <name>Internal Releases</name>
            <url>http://localhost:8081/nexus/content/repositories/releases/</url>
        </repository>
        <snapshotRepository>
            <id>snapshots</id>
            <name>Internal Snapshots</name>
            <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
        </snapshotRepository>
    </distributionManagement>

    <dependencies>

        <!--日志: -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.7</version>
        </dependency>

        <!--测试: -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <finalName>practice</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>

            <!--deploy source -->
            <plugin>
                <artifactId>maven-source-plugin</artifactId>
                <version>2.2.1</version>
                <configuration>
                    <attach>true</attach>
                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!--deploy javadoc -->
            <plugin>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <charset>UTF-8</charset>
                    <docencoding>UTF-8</docencoding>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

 

deploy:

bubuko.com,布布扣

在  http://localhost:8081/nexus/index.html   查看:

bubuko.com,布布扣

maven deploy

标签:style   blog   http   color   os   java   io   文件   ar   

原文地址:http://www.cnblogs.com/muzhongjiang/p/3939303.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!