简体   繁体   English

无法解析的构建扩展:插件 org.eclipse.tycho:tycho-maven

[英]Unresolveable build extension: Plugin org.eclipse.tycho:tycho-maven

I am using 'Tycho'(Maven) for eclipse plugin project build .我正在使用 'Tycho'(Maven) 进行 Eclipse 插件项目构建。

I am getting the error :我收到错误:

Unresolveable build extension: Plugin org.eclipse.tycho:tycho-maven-plugin:0.22.0 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.eclipse.tycho:tycho-maven-plugin:jar:0.22.0: Could not transfer artifact org.eclipse.tycho:tycho-maven-plugin:pom:0.22.0 from/to central ( https://repo.maven.apache.org/maven2 ): connect timed out -> [Help 2]无法解析的构建扩展:插件 org.eclipse.tycho:tycho-maven-plugin:0.22.0 或其依赖项之一无法解析:无法读取 org.eclipse.tycho:tycho-maven-plugin:jar 的工件描述符: 0.22.0:无法从中央( https://repo.maven.apache.org/maven2 )传输工件 org.eclipse.tycho:tycho-maven-plugin:pom:0.22.0:连接超时 -> [帮助2]

POM.xml file looks like 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/xsd/maven-4.0.0.xsd">  
 <modelVersion>4.0.0</modelVersion>  
 <groupId>tycho_example</groupId>  
 <artifactId>com.codeandme.tycho.plugin</artifactId>  
 <version>1.0.0-SNAPSHOT</version>  
 <packaging>pom</packaging>  

 <properties>  
  <tycho.version>0.22.0</tycho.version>  
 </properties>  

 <repositories>  
  <!-- add Mars repository to resolve dependencies -->  
  <repository>  
   <id>Mars</id>  
   <layout>p2</layout>  
   <url>http://download.eclipse.org/releases/mars/</url>  
  </repository>  
 </repositories>  

 <build>  
  <plugins>  
   <plugin>  
    <!-- enable tycho build extension -->  
    <groupId>org.eclipse.tycho</groupId>  
    <artifactId>tycho-maven-plugin</artifactId>  
    <version>${tycho.version}</version>  
    <extensions>true</extensions>  
   </plugin>  
  </plugins>  
 </build>  
</project>  

I am sure your problem is solved.我相信你的问题已经解决了。 However, for others who have the same error,the solution is : Include the tag <pluginManagement> in parent pom.xml file.但是,对于其他有相同错误的人,解决方案是:在父 pom.xml 文件中包含标签<pluginManagement> <pluginManagement> is only a way to share the same plugin configuration across all your project modules.Here is sample parent pom.xml file <pluginManagement>只是在所有项目模块中共享相同插件配置的一种方式。这是示例父 pom.xml 文件

<build>
        <pluginManagement>
        <plugins>
            <plugin>
                <groupId>${tycho-groupid}</groupId>
                <artifactId>tycho-maven-plugin</artifactId>
                <version>${tycho-version}</version>
                <extensions>true</extensions>
            </plugin>
            <plugin>
                <groupId>${tycho-groupid}</groupId>
                <artifactId>target-platform-configuration</artifactId>
                <version>${tycho-version}</version>
                <configuration>
                    <resolver>p2</resolver>
                    <environments>
                        <environment>
                            <os>win32</os>
                            <ws>win32</ws>
                            <arch>x86</arch>
                        </environment>
                        <environment>
                            <os>macosx</os>
                            <ws>cocoa</ws>
                            <arch>x86_64</arch>
                        </environment>
                        <environment>
                            <os>linux</os>
                            <ws>gtk</ws>
                            <arch>x86_64</arch>
                        </environment>
                    </environments>
                </configuration>
            </plugin>
        </plugins>
        </pluginManagement>
    </build>

This can't be solved by adding这不能通过添加来解决

<PluginManagement> 
   ... 
</PluginManagement>

It's simply because the eclipse m2e connector can't download these plugins from a repo.这只是因为 eclipse m2e 连接器无法从 repo 下载这些插件。 Open your Maven Console and see if it prints something after you saved your pom.xml it probably will tell you, that it couldn't acces the repo or no maven settings.xml is assigned to the m2e connector.打开你的 Maven 控制台,看看它是否在你保存pom.xml后打印一些东西,它可能会告诉你,它无法访问 repo 或者没有 maven settings.xml被分配给 m2e 连接器。

Find the full Solution here: Maven: unresolvable build extension在这里找到完整的解决方案: Maven:无法解析的构建扩展

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM