Maven: unresolvable build extension

2019-08-05 13:21发布

问题:

I've been looking at google and nothing really points to this problem. When I run "mvn clean install" it returns the following error.

[ERROR] Unresolveable build extension: Plugin org.sonatype.flexmojos:flexmojos-maven-plugin:3.8 or one of its dependencies could not be resolved: Failed to collect dependencies for org.sonatype.flexmojos:flexmojos-maven-plugin:jar:3.8 ()

I'm trying to figure out how to import the maven plugin flexmojos but there are no clear directions on how to do this.

How would I import this plugin into my project?

ejay

回答1:

The dependency you are looking for does exist. To troubleshoot this problem further we'd need to see your POM and the rest of your build output.

Taking a stab in the dark:

Is this the first time you're running this build on this machine? If so, a very common "gotcha" is a corporate firewall preventing access to Maven Central. The solution in this case is setup a Maven repository manager like Nexus, or configure Maven to use a HTTP proxy.



回答2:

I had a similar problem. I set up the proxy in Eclipse then I discovered I also set up the proxy in my settings.xml. I deleted the proxy from settings.xml and all worked out.

I hope my situation will help!



回答3:

I solved this by adding another profile parameter from my pom.xml to my mvn command, e.g. "-Pprofile-name" pointing to a non-Maven repo definition embedded inside that profile, since Maven might be looking for repo definitions to be standing alone in a settings.xml, which isn't always the case.



回答4:

I resolved this by adding a settings.xml file in the ~\.m2 directory, with the appropriate configuration pointing to our internal libraries.



回答5:

If this Problem is displayed in the Eclipse Environment, this is because the m2e Connector tries to download the Plugins in to your ~\.m2\ repository

to solve this, open your Eclipse Settings: Window->Preferences and go to the ->Maven->User Settings Section. Check if either Global Settings or User Settings is connected to the settings.xml File that your Maven uses.

Generally: Maven or your m2e connector tries to download these plugins via the plugin-repositories configured in your settings.xml it's can't find them because the repository is unknown or not reachable because you are behind a proxy or so:

08.11.18, 15:54:47 MEZ: [WARN] Failed to build parent project for com.xxx.xxx.xxx:eclipse-plugin:1.0.0-SNAPSHOT
08.11.18, 15:54:47 MEZ: [WARN] Failure to transfer org.apache.maven.plugins:maven-site-plugin/maven-metadata.xml from http://repository.sonatype.org/content/groups/sonatype-public-grid was cached in the local repository, resolution will not be reattempted until the update interval of tycho has elapsed or updates are forced. Original error: Could not transfer metadata org.apache.maven.plugins:maven-site-plugin/maven-metadata.xml from/to tycho (http://repository.sonatype.org/content/groups/sonatype-public-grid): repository.sonatype.org

go to your settings.xml file and add:

Mirrors (in this example: central repository. Do so for any other repos accordingly e.g. tycho):

<mirror>
    <id>central</id>
    <name>Our mirror for central repo</name>
    <url>http://<your host to>/nexus/content/repositories/central/</url>
    <mirrorOf>central</mirrorOf>
</mirror>

Repository:

<repository>
    <id>central</id>
    <url>http://<your host to>/nexus/content/groups/public/</url>
    <layout>default</layout>
    <releases> 
         <enabled>true</enabled>
         <updatePolicy>daily</updatePolicy>
         <checksumPolicy>warn</checksumPolicy>
    </releases>
</repository>

this should fix your problems:

Eclipse Specific: if Errors prevails (e.g. unknown packaging) add lifecycle mappings via Window->Preferences->Maven->Discovery->Open Catalog and add Tycho Connector Further you can add the lifecycle-mapping plugin that handles these lifecycle mappings in the eclipse environment: eclipse m2e lifecycle mappings