eclipse 在 maven 中构建包时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/36578962/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error while building bundle in maven
提问by bimal gupta
I am trying to build a bundle from existing maven project which is in eclipse. I have most of the repository dependencies, still though it tries to download a few dependencies. after that it give list of errors which is below.Can anybody tell how to remove existing errors and build a bundle successfully. I am building the bundle for Adobe Aem aq5 tool where it accepts jar files as bundles to be installed.
我正在尝试从 eclipse 中的现有 maven 项目构建一个包。我拥有大部分存储库依赖项,但它仍然尝试下载一些依赖项。之后它给出了下面的错误列表。任何人都可以告诉如何删除现有错误并成功构建包。我正在为 Adobe Aem aq5 工具构建包,它接受 jar 文件作为要安装的包。
[ERROR] Unresolveable build extension: Plugin org.apache.felix:maven-bundle-plug
in:2.3.7 or one of its dependencies could not be resolved: The following artifac
ts could not be resolved: org.apache.maven:maven-core:jar:2.0.7, org.apache.mave
n:maven-settings:jar:2.0.7, org.apache.maven:maven-plugin-parameter-documenter:j
ar:2.0.7, org.apache.maven:maven-profile:jar:2.0.7, org.apache.maven:maven-model
:jar:2.0.7, org.apache.maven:maven-artifact:jar:2.0.7, org.codehaus.plexus:plexu
s-container-default:jar:1.0-alpha-9-stable-1, org.apache.maven:maven-repository-
metadata:jar:2.0.7, org.apache.maven:maven-error-diagnostics:jar:2.0.7, org.apac
he.maven:maven-project:jar:2.0.7, org.apache.maven:maven-plugin-registry:jar:2.0
.7, org.apache.maven:maven-plugin-descriptor:jar:2.0.7, org.apache.maven:maven-a
rtifact-manager:jar:2.0.7, org.apache.maven:maven-monitor:jar:2.0.7, classworlds
:classworlds:jar:1.1: Could not transfer artifact org.apache.maven:maven-core:ja
r:2.0.7 from/to adobe (http://repo.adobe.com/nexus/content/groups/public/): sun.
security.validator.ValidatorException: PKIX path building failed: sun.security.p
rovider.certpath.SunCertPathBuilderException: unable to find valid certification
path to requested target @
[ERROR] Unknown packaging: bundle @ com.lundbeck.master.nohmatters:nohmatters-bu
ndle:[unknown-version], D:\CODEBASE\nohmatters\bundle\pom.xml, line 19, column 1
6
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.lundbeck.master.nohmatters:nohmatters-bundle:1.0.0-SNA
PSHOT (D:\CODEBASE\nohmatters\bundle\pom.xml) has 2 errors
[ERROR] Unresolveable build extension: Plugin org.apache.felix:maven-bundle-
plugin:2.3.7 or one of its dependencies could not be resolved: The following art
ifacts could not be resolved: org.apache.maven:maven-core:jar:2.0.7, org.apache.
maven:maven-settings:jar:2.0.7, org.apache.maven:maven-plugin-parameter-document
er:jar:2.0.7, org.apache.maven:maven-profile:jar:2.0.7, org.apache.maven:maven-m
odel:jar:2.0.7, org.apache.maven:maven-artifact:jar:2.0.7, org.codehaus.plexus:p
lexus-container-default:jar:1.0-alpha-9-stable-1, org.apache.maven:maven-reposit
ory-metadata:jar:2.0.7, org.apache.maven:maven-error-diagnostics:jar:2.0.7, org.
apache.maven:maven-project:jar:2.0.7, org.apache.maven:maven-plugin-registry:jar
:2.0.7, org.apache.maven:maven-plugin-descriptor:jar:2.0.7, org.apache.maven:mav
en-artifact-manager:jar:2.0.7, org.apache.maven:maven-monitor:jar:2.0.7, classwo
rlds:classworlds:jar:1.1: Could not transfer artifact org.apache.maven:maven-cor
e:jar:2.0.7 from/to adobe (http://repo.adobe.com/nexus/content/groups/public/):
sun.security.validator.ValidatorException: PKIX path building failed: sun.securi
ty.provider.certpath.SunCertPathBuilderException: unable to find valid certifica
tion path to requested target -> [Help 2]
[ERROR] Unknown packaging: bundle @ com.lundbeck.master.nohmatters:nohmatter
s-bundle:[unknown-version], D:\CODEBASE\nohmatters\bundle\pom.xml, line 19, colu
mn 16
my pom.xml is as following:
我的 pom.xml 如下:
<?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>
<!-- ====================================================================== -->
<!-- P A R E N T P R O J E C T D E S C R I P T I O N -->
<!-- ====================================================================== -->
<parent>
<groupId>com.lundbeck.master.nohmatters</groupId>
<artifactId>nohmatters</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<!-- ====================================================================== -->
<!-- P R O J E C T D E S C R I P T I O N -->
<!-- ====================================================================== -->
<artifactId>nohmatters-bundle</artifactId>
<packaging>bundle</packaging>
<name>nohmatters Bundle</name>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
</dependency>
<dependency>
<groupId>biz.aQute</groupId>
<artifactId>bndlib</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.jcr.api</artifactId>
</dependency>
<dependency>
<groupId>com.day.cq.wcm</groupId>
<artifactId>cq-wcm-workflow-api</artifactId>
<version>5.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.day.cq.wcm</groupId>
<artifactId>cq-wcm-api</artifactId>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>com.day.cq</groupId>
<artifactId>cq-commons</artifactId>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.json</artifactId>
<version>2.0.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.day.cq</groupId>
<artifactId>cq-mailer</artifactId>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>com.day.cq</groupId>
<artifactId>cq-search</artifactId>
<version>5.5.4</version>
</dependency>
<dependency>
<groupId>com.adobe.granite</groupId>
<artifactId>com.adobe.granite.xssprotection</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.resourceresolver</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
<version>2.9.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.6</version>
</dependency>
<dependency>
<groupId>com.itextpdf.tool</groupId>
<artifactId>xmlworker</artifactId>
<version>5.5.6</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.53</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.1.0</version>
<classifier>obfuscated-apis</classifier>
<scope>provided</scope>
</dependency>
</dependencies>
<!-- ====================================================================== -->
<!-- B U I L D D E F I N I T I O N -->
<!-- ====================================================================== -->
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<executions>
<execution>
<id>generate-scr-descriptor</id>
<goals>
<goal>scr</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>com.lundbeck.master.nohmatters.nohmatters-bundle</Bundle-SymbolicName>
<Import-Package>org.osgi.framework,*</Import-Package>
<Export-Package>com.lundbeck.master.nohmatters.*,com.lundbeck.master.nohmatters.servlet.EmailServlet,com.jcraft.*;com.jcraft.jzlib</Export-Package>
<Include-Resource>{maven-resources}</Include-Resource>
<Import-Bundle>*</Import-Bundle>
<Embed-Dependency>gson</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Private-Package>com.lundbeck.master.nohmatters.servlet.*,com.jcraft.*</Private-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>maven-sling-plugin</artifactId>
<configuration>
<slingUrl>http://${crx.host}:${crx.port}/apps/nohmatters/install</slingUrl>
<usePut>true</usePut>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<excludePackageNames>
*.impl
</excludePackageNames>
</configuration>
</plugin>
</plugins>
</build>
</project>
<?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>
<!-- ====================================================================== -->
<!-- P A R E N T P R O J E C T D E S C R I P T I O N -->
<!-- ====================================================================== -->
<parent>
<groupId>com.lundbeck.master.nohmatters</groupId>
<artifactId>nohmatters</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<!-- ====================================================================== -->
<!-- P R O J E C T D E S C R I P T I O N -->
<!-- ====================================================================== -->
<artifactId>nohmatters-bundle</artifactId>
<packaging>bundle</packaging>
<name>nohmatters Bundle</name>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.scr.annotations</artifactId>
</dependency>
<dependency>
<groupId>biz.aQute</groupId>
<artifactId>bndlib</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.jcr.api</artifactId>
</dependency>
<dependency>
<groupId>com.day.cq.wcm</groupId>
<artifactId>cq-wcm-workflow-api</artifactId>
<version>5.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.day.cq.wcm</groupId>
<artifactId>cq-wcm-api</artifactId>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>com.day.cq</groupId>
<artifactId>cq-commons</artifactId>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.json</artifactId>
<version>2.0.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.day.cq</groupId>
<artifactId>cq-mailer</artifactId>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>com.day.cq</groupId>
<artifactId>cq-search</artifactId>
<version>5.5.4</version>
</dependency>
<dependency>
<groupId>com.adobe.granite</groupId>
<artifactId>com.adobe.granite.xssprotection</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.resourceresolver</artifactId>
</dependency>
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.api</artifactId>
<version>2.9.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.6</version>
</dependency>
<dependency>
<groupId>com.itextpdf.tool</groupId>
<artifactId>xmlworker</artifactId>
<version>5.5.6</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.53</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jzlib</artifactId>
<version>1.1.3</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>com.adobe.aem</groupId>
<artifactId>uber-jar</artifactId>
<version>6.1.0</version>
<classifier>obfuscated-apis</classifier>
<scope>provided</scope>
</dependency>
</dependencies>
<!-- ====================================================================== -->
<!-- B U I L D D E F I N I T I O N -->
<!-- ====================================================================== -->
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
<executions>
<execution>
<id>generate-scr-descriptor</id>
<goals>
<goal>scr</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>com.lundbeck.master.nohmatters.nohmatters-bundle</Bundle-SymbolicName>
<Import-Package>org.osgi.framework,*</Import-Package>
<Export-Package>com.lundbeck.master.nohmatters.*,com.lundbeck.master.nohmatters.servlet.EmailServlet,com.jcraft.*;com.jcraft.jzlib</Export-Package>
<Include-Resource>{maven-resources}</Include-Resource>
<Import-Bundle>*</Import-Bundle>
<Embed-Dependency>gson</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Private-Package>com.lundbeck.master.nohmatters.servlet.*,com.jcraft.*</Private-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.sling</groupId>
<artifactId>maven-sling-plugin</artifactId>
<configuration>
<slingUrl>http://${crx.host}:${crx.port}/apps/nohmatters/install</slingUrl>
<usePut>true</usePut>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<excludePackageNames>
*.impl
</excludePackageNames>
</configuration>
</plugin>
</plugins>
</build>
</project>
回答by tinku
The dependency must contain the all of the 3 required parameter so that it can download the exact jar.
依赖项必须包含所有 3 个必需参数,以便它可以下载确切的 jar。
As the error mentioned here is the
由于这里提到的错误是
Plugin org.apache.felix:maven-bundle-plug in:2.3.7 or one of its dependencies could not be resolved
插件 org.apache.felix:maven-bundle-plug in:2.3.7 或其依赖项之一无法解析
This is because you haven't provided the version that you want to download.
这是因为您尚未提供要下载的版本。
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
</dependency>
Try this it will provide you the exact maven bundle plugin 2.3.7
试试这个它会为你提供确切的 maven bundle 插件 2.3.7
http://mvnrepository.com/artifact/org.apache.felix/maven-bundle-plugin/2.3.7
http://mvnrepository.com/artifact/org.apache.felix/maven-bundle-plugin/2.3.7
回答by begginghard
you need to check whether your maven private repository is ok. If you don't use private repository, you need to whether your maven central repository.
您需要检查您的 Maven 私有存储库是否正常。如果你不使用私有仓库,你需要是否你的 maven 中央仓库。
Usually, you will configure your private maven repository in ~/.m2/settings.xml 。 https://maven.apache.org/settings.html#Repositories
通常,您会在 ~/.m2/settings.xml 中配置您的私有 Maven 存储库。 https://maven.apache.org/settings.html#Repositories
for example:
例如:
无法计算构建计划:插件 org.apache.maven.plugins:maven-resources-plugin:2.5 或其依赖项之一无法解析