亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

maven-assembly-plugin報紅無法加載報錯:Plugin?‘maven-assembly-plugin:‘?not?found

 更新時間:2023年08月08日 15:02:13   作者:海若[MATRIX]  
maven-assembly-plugin是一個常用的打包插件,但是在使用過程中經(jīng)常會遇到各種報錯,本文就來介紹一下maven-assembly-plugin報紅無法加載報錯,具有一定的參考價值

1.問題描述

maven pom.xml中maven-assembly-plugin報紅,無法加載

2.pom文件build構(gòu)建部分詳解

  <build>
    <!--當(dāng)項目沒有規(guī)定目標(biāo)(Maven2 叫做階段)時的默認(rèn)值-->
    <defaultGoal>install</defaultGoal>
    <!--build目標(biāo)文件的存放目錄,默認(rèn)在 ${basedir}/target 目錄-->
    <directory>${basedir}/target</directory>
    <finalName>${artifactId}-${version}</finalName>
    <filters>
      <filter>filters/filter1.properties</filter>
    </filters>
    <!--這個元素描述了項目相關(guān)的所有資源路徑列表,例如和項目相關(guān)的屬性文件,這些資源被包含在最終的打包文件里。-->    
    <resources>    
      <!--這個元素描述了項目相關(guān)或測試相關(guān)的所有資源路徑-->    
      <resource>    
        <!-- 描述了資源的目標(biāo)路徑。該路徑相對target/classes目錄(例如${project.build.outputDirectory})。舉個例 子,如果你想資源在特定的包里(   org.apache.maven.message,你就必須該元素設(shè)置為org/apache/maven /messages。然而,如果你只是想把資源放到源碼目錄結(jié)構(gòu)里,就不需要該配置。-->    
        <targetPath/>    
        <!--是否使用參數(shù)值代替參數(shù)名。參數(shù)值取自properties元素或者文件里配置的屬性,文件在filters元素里列出。-->    
        <filtering/>    
        <!--描述存放資源的目錄,該路徑相對POM路徑-->    
        <directory/>    
        <!--包含的模式列表,例如**/*.xml.-->    
        <includes/>    
        <!--排除的模式列表,例如**/*.xml-->    
        <excludes/>    
      </resource>    
    </resources>    
    <!--這個元素描述了單元測試相關(guān)的所有資源路徑,例如和單元測試相關(guān)的屬性文件。-->    
    <testResources>    
      <!--這個元素描述了測試相關(guān)的所有資源路徑,參見build/resources/resource元素的說明-->    
      <testResource>    
        <targetPath/>
        <filtering/>
        <directory/>
        <includes/>
        <excludes/>    
      </testResource>    
    </testResources>
<!-- 在build時,執(zhí)行的插件,比較有用的部分,如使用jdk 8.0編譯等等-->
    <plugins>
      <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.3</version>
          <configuration>
              <tagBase>${git.conn}</tagBase>
              <branchBase>${git.conn}</branchBase>
              <username>${git.username}</username>
              <password>${git.password}</password>
          </configuration>
      </plugin>
      ...
    </plugins>
    <!--子項目可以引用的默認(rèn)插件信息。該插件配置項直到被引用時才會被解析或綁定到生命周期。給定插件的任何本地配置都會覆蓋這里的配置-->
    <pluginManagement>
      <plugins>
        ...
      </plugins>
    </pluginManagement>
  </build>
</project>

3.pom文件dependencies依賴部分詳解

依賴關(guān)系:

<dependencies>  
    <dependency>  
      <groupId>junit</groupId>  
      <artifactId>junit</artifactId>  
      <version>4.0</version>  
      <type>jar</type>  
      <scope>test</scope>  
      <optional>true</optional>  
    </dependency>  
    ...  
  </dependencies>

groupId, artifactId, version:描述了依賴的項目唯一標(biāo)志

可以通過以下方式進(jìn)行安裝:

使用以下的命令安裝:

mvn install:install-file –Dfile=non-maven-proj.jar –DgroupId=some.group –DartifactId=non-maven-proj –Dversion=1創(chuàng)建自己的庫,并配置,使用deploy:deploy-file

設(shè)置此依賴范圍為system,定義一個系統(tǒng)路徑。不提倡。

  • type:相應(yīng)的依賴產(chǎn)品包形式,如jar,war
  • scope:用于限制相應(yīng)的依賴范圍,包括以下的幾種變量:
  • compile :默認(rèn)范圍,用于編譯
  • provided:類似于編譯,但支持你期待jdk或者容器提供,類似于classpath
  • runtime:在執(zhí)行時,需要使用
  • test:用于test任務(wù)時使用
  • system:需要外在提供相應(yīng)得元素。通過systemPath來取得
  • systemPath: 僅用于范圍為system。提供相應(yīng)的路徑
  • optional: 標(biāo)注可選,當(dāng)項目自身也是依賴時。用于連續(xù)依賴時使用獨(dú)占性外在告訴maven你只包括指定的項目,不包括相關(guān)的依賴。此因素主要用于解決版本沖突問題
<dependencies>  
    <dependency>  
      <groupId>org.apache.maven</groupId>  
      <artifactId>maven-embedder</artifactId>  
      <version>2.0</version>  
      <exclusions>  
        <exclusion>  
          <groupId>org.apache.maven</groupId>  
          <artifactId>maven-core</artifactId>  
        </exclusion>  
      </exclusions>  
    </dependency>

表示項目maven-embedder需要項目maven-core,但我們不想引用maven-core

4.pom文件其他標(biāo)簽描述

  • 繼承關(guān)系
  • 一個強(qiáng)大的變化,maven帶來的是項目繼承。主要的設(shè)置:
  • 定義父項目
<project>  
  <modelVersion>4.0.0</modelVersion>  
  <groupId>org.gene.demo</groupId>  
  <artifactId>my-parent</artifactId>  
  <version>2.0</version>  
  <packaging>pom</packaging>  
</project>

packaging 類型,需要pom用于parent和合成多個項目。我們需要增加相應(yīng)的值給父pom,用于子項目繼承。主要的元素如下:

  • 依賴型
  • 開發(fā)者和合作者
  • 插件列表
  • 報表列表
  • 插件執(zhí)行使用相應(yīng)的匹配ids
  • 插件配置
  • 子項目配置
<project>  
  <modelVersion>4.0.0</modelVersion>  
  <parent>  
    <groupId>org.gene.demo</groupId>  
    <artifactId>my-parent</artifactId>  
    <version>2.0</version>  
    <relativePath>../my-parent</relativePath>  
  </parent>  
  <artifactId>my-project</artifactId>  
</project>

relativePath可以不需要,但是用于指明parent的目錄,用于快速查詢。

dependencyManagement:
用于父項目配置共同的依賴關(guān)系,主要配置依賴包相同因素,如版本,scope。

合成(或者多個模塊)
一個項目有多個模塊,也叫做多重模塊,或者合成項目。
如下的定義:

<project>  
  <modelVersion>4.0.0</modelVersion>  
  <groupId>org.gene.demo</groupId>  
  <artifactId>my-parent</artifactId>  
  <version>2.0</version>  
  <modules>  
    <module>my-project1</module>  
    <module>my-project2</module>  
  </modules>  
</project>

5.解決方案

由于,build中插件無法自動加載,在依賴中添加對應(yīng)依賴更新后即可成功加載。

<dependencies>
    <dependency>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>3.0.0</version>
    </dependency>
</dependencies>

到此這篇關(guān)于maven-assembly-plugin報紅無法加載報錯:Plugin ‘maven-assembly-plugin:‘ not found的文章就介紹到這了,更多相關(guān)maven-assembly-plugin報紅內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論