错误Maven POM文件的XML文件:构建Android项目文件、错误、项目、Maven

2023-09-07 15:39:21 作者:ー年少轻狂°染指成伤づ

我得到在POM XML文件中的插件标记错误。该错误是在插件标签,之前的groupId。

错误 -

 插件执行未涵盖的生命周期配置:com.jayway.maven.plugins.android.generation2:Android的Maven的插件:3.8.2:消耗-AAR(执行:默认 - 消费-AAR,阶段:编译) 

中的任何一个都知道如何解决此问题。下面提到的是pom.xml文件内容

pom.xml文件

 <?XML版本=1.0编码=UTF-8&GT?;<项目的xmlns =htt​​p://maven.apache.org/POM/4.0.0的xmlns:XSI =htt​​p://www.w3.org/2001/XMLSchema-instanceXSI:=的schemaLocationHTTP: //maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">  < modelVersion> 4.0.0< / modelVersion>  <&的groupId GT; com.simpligility.android< /的groupId>  <&的artifactId GT; helloflashlight< / artifactId的>  <&版GT; 1.0.0< /版本>  <包装和GT;&APK LT; /包装>  <名称>&HelloFlashlight LT; /名称>  <依赖和GT;    <&依赖性GT;      <&的groupId GT; com.google.android< /的groupId>      <&的artifactId GT; Android设备和LT; / artifactId的>      <&版GT; 4.1.1.4< /版本>      <&范围GT;及提供LT; /&范围GT;    < /依赖性>  < /依赖和GT;  <建立>    < sourceDirectory>&SRC LT; / sourceDirectory>    < finalName> $ {project.artifactId}< / finalName>    < pluginManagement>      <&插件GT;        <&插件GT;          <&的groupId GT; com.jayway.maven.plugins.android.generation2< /的groupId>          <&的artifactId GT; Android的Maven的插件< / artifactId的>          <&版GT; 3.8.2< /版本>          <附加功能,GT;真< /扩展>        < /插件>      < /插件>    < / pluginManagement>    <&插件GT;      <&插件GT;        <&的groupId GT; com.jayway.maven.plugins.android.generation2< /的groupId>        <&的artifactId GT; Android的Maven的插件< / artifactId的>        <结构>          < SDK开发及GT;                        <! - 平台API级(API级别16 = 4.1平台) -  GT;            <平台和GT; 16 LT; /平台>          < / SDK>        < /结构>      < /插件>    < /插件>  < /构建>< /项目> 

解决方案 Maven中pom.xml文件报错的原因

要在沉默中的错误的pom.xml可以在里面加入以下内容:

 < pluginManagement>     <&插件GT;      <&插件GT;       <&的groupId GT; org.eclipse.m2e< /的groupId>        <&的artifactId GT;生命周期映射< / artifactId的>         <&版GT; 1.0.0< /版本>       <结构>        < lifecycleMappingMetadata>          < pluginExecutions>           < pluginExecution>            < pluginExecutionFilter>              <&的groupId GT; com.jayway.maven.plugins.android.generation2< /的groupId>             <&的artifactId GT; Android的Maven的插件< / artifactId的>             < versionRange> [1.0.0,)LT; / versionRange>              <目标>               <&目标GT;消费-AAR< /目标>              < /目标>             < / pluginExecutionFilter>            <作用>             <忽略/>            < / pluginExecution>           < /作用>           < / pluginExecutions>          < / lifecycleMappingMetadata>         < /结构>       < /插件>       。 。 。 

I am getting the error in plugin tag in pom xml file. The error is on plugin tag, before groupId.

Error:-

Plugin execution not covered by lifecycle configuration:com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:consume-aar (execution: default-consume-aar, phase: compile)

Any one knows how to resolve this problem. Below mentioned is the pom.xml file contents

pom.xml file

<?xml version="1.0" encoding="UTF-8"?>
<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.simpligility.android</groupId>
  <artifactId>helloflashlight</artifactId>
  <version>1.0.0</version>
  <packaging>apk</packaging>

  <name>HelloFlashlight</name>

  <dependencies>
    <dependency>
      <groupId>com.google.android</groupId>
      <artifactId>android</artifactId>
      <version>4.1.1.4</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <sourceDirectory>src</sourceDirectory>
    <finalName>${project.artifactId}</finalName>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.jayway.maven.plugins.android.generation2</groupId>
          <artifactId>android-maven-plugin</artifactId>
          <version>3.8.2</version>
          <extensions>true</extensions>
        </plugin>
      </plugins>
    </pluginManagement>
    <plugins>
      <plugin>
        <groupId>com.jayway.maven.plugins.android.generation2</groupId>
        <artifactId>android-maven-plugin</artifactId>
        <configuration>
          <sdk>
                        <!-- platform as api level (api level 16 = platform 4.1)-->
            <platform>16</platform>
          </sdk>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>

解决方案

To silence the error in pom.xml the following could be added in there:

    <pluginManagement>
     <plugins>
      <plugin>
       <groupId>org.eclipse.m2e</groupId>
        <artifactId>lifecycle-mapping</artifactId>
         <version>1.0.0</version>
       <configuration>
        <lifecycleMappingMetadata>
          <pluginExecutions>
           <pluginExecution>
            <pluginExecutionFilter>
              <groupId>com.jayway.maven.plugins.android.generation2</groupId>
             <artifactId>android-maven-plugin</artifactId>
             <versionRange>[1.0.0,)</versionRange>
              <goals>
               <goal>consume-aar</goal>
              </goals>
             </pluginExecutionFilter>
            <action>
             <ignore />
            </pluginExecution>
           </action>
           </pluginExecutions>
          </lifecycleMappingMetadata>
         </configuration>
       </plugin>
       . . . 

 
精彩推荐