【发布时间】:2022-05-11 02:58:32
【问题描述】:
在将 maven 项目构建为 OSGI 包时,我在 MANIFEST 的导入包中获得了一些依赖错误版本范围。 这发生在内部依赖上,我突然说,因为这是多年来的工作,而问题发生在今天。
该项目的 pom 看起来像:
<?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/xsd/maven-4.0.0.xsd\">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.xxxxxx.yyyy</groupId>
<artifactId>yyyy-features</artifactId>
<version>9.0.0-SNAPSHOT</version>
</parent>
<groupId>com.xxxxxx.yyyy</groupId>
<artifactId>com.xxxxxx.yyyy.command</artifactId>
<packaging>bundle</packaging>
<name>${project.artifactId}</name>
<dependencies>
[...]
<dependency>
<groupId>com.xxxxxx.yyyy.m2m</groupId>
<artifactId>com.xxxxxx.yyyy.m2m.config</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.xxxxxx.yyyy.importexport</groupId>
<artifactId>com.xxxxxx.yyyy.importexport.api</artifactId>
<version>${project.version}</version>
</dependency>
[...]
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>com.xxxxxx.yyyy.command.*</Export-Package>
<Karaf-Commands>*</Karaf-Commands>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
清单看起来像:
Manifest-Version: 1.0
Bnd-LastModified: 1652108014425
Build-Jdk: 11.0.11
Built-By: wwhite
Bundle-Blueprint: OSGI-INF/blueprint/blueprint.xml
Bundle-Description: YYYYYYYYY yyyy
Bundle-DocURL: https://www.xxxxxx.com/
Bundle-ManifestVersion: 2
Bundle-Name: com.xxxxxx.yyyy.command
Bundle-SymbolicName: com.xxxxxx.yyyy.command
Bundle-Vendor: YYYYYY yyyy YYYYYY
Bundle-Version: 9.0.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Export-Package: com.xxxxxx.yyyy.command;uses:=\"com.xxxxxx.yyyy.commo
n,com.xxxxxx.yyyy.connector.spi,com.xxxxxx.yyyy.model.core
[...]
Import-Package: com.xxxxxx.yyyy.importexport.api;version=\"[9.0,10)\",
com.xxxxxx.yyyy.importexport.api.model;version=\"[9.0,10)\",com.xxxxxx.yyyy.m2m
;version=\"[8.1,9)\",com.xxxxxx.yyyy.m2m.bean;version=\"[8.1,9)\",com.so
prahr.edsn.m2m.config;version=\"[8.1,9)\",com.xxxxxx.yyyy.m2m.config.b
ean;version=\"[8.1,9)\",com.xxxxxx.yyyy.m2m.utils;version=\"[8.1,9)\"
[...]
Service-Component: OSGI-INF/com.xxxxxx.yyyy.command.m2m.resync.Resync
ServiceImpl.xml
Specification-Title: com.xxxxxx.yyyy.command
Specification-Vendor: XXXXXXXXXX
Specification-Version: 9.0.0-SNAPSHOT
Tool: Bnd-4.2.0.201903051501
当前的项目版本是 9.0.0-SNAPSHOT 所以我希望 [9.0, 10) 版本范围适用于项目版本的所有依赖项,但由于一个模糊的原因,我得到 [8.1,9) 包 com.xxxxxx.yyyy.m2m.*
我为项目 com.xxxxxx.yyyy.m2m.config 构建了一个 denpency 树(mvn dependency:tree),但获得了良好的依赖版本 9.0.0-SNAPSHOT。
我尝试了许多其他的东西,无论是否使用 Netbeans 构建,构建前清洁,清洁我所有的 .m2/com/xxxxxx/yyyy
我正在努力寻找错误范围版本的原因,所以如果您对我有任何想法,谢谢!
祝你有美好的一天。
标签: maven version osgi manifest