zoukankan      html  css  js  c++  java
  • 将项目安装到Maven本地资源库

    在Maven中,可以使用“mvn install”打包项目,并自动部署到本地资源库,让其他开发人员使用它。

    mvn install
    注意,
    当“install”在执行阶段,上述所有阶段 “validate“, “compile“, “test“, “package“, “integration-test“, “verify” 阶段, 包括目前的“install”阶段将被执行有序。请参阅Maven的生命周期细节。

    mvn install 示例

    一个Java项目,具有以下 pom.xml 文件

    File : 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.yiibai.core</groupId>
      <artifactId>yiibai-core</artifactId>
      <packaging>jar</packaging>
      <version>99</version>
      <name>yiibai-core</name>
      <url>http://maven.apache.org</url>
      <dependencies>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.4</version>
          <scope>test</scope>
        </dependency>
      </dependencies>
    </project>

    基于以上pom.xml文件,在“mvn install”被执行,它会打包项目为“yiibai-core-99.jar”文件,并复制到本地存储库。

     
    警告
    它总是建议运行“clean”和“install”在一起,让您能始终部署最新的项目到本地存储库。
    mvn clean install
  • 相关阅读:
    MVC模式-----struts2框架(2)
    MVC模式-----struts2框架
    html的<h>标签
    jsp脚本元素
    LeetCode "Paint House"
    LeetCode "Longest Substring with At Most Two Distinct Characters"
    LeetCode "Graph Valid Tree"
    LeetCode "Shortest Word Distance"
    LeetCode "Verify Preorder Sequence in Binary Search Tree"
    LeetCode "Binary Tree Upside Down"
  • 原文地址:https://www.cnblogs.com/borter/p/9605654.html
Copyright © 2011-2022 走看看