maven bundle插件和pax检查:MANIFEST.MF不存在
以下情况:我正在使用maven和maven bundle插件开发一个OSGi应用程序。我想运行单元测试并发现Pax考试,我觉得它很合适 这是我的父母pom.xmlmaven bundle插件和pax检查:MANIFEST.MF不存在,maven,osgi,apache-felix,maven-bundle-plugin,pax-exam,Maven,Osgi,Apache Felix,Maven Bundle Plugin,Pax Exam,以下情况:我正在使用maven和maven bundle插件开发一个OSGi应用程序。我想运行单元测试并发现Pax考试,我觉得它很合适 这是我的父母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:/
<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>de.hswt.oms</groupId>
<artifactId>workspace-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>com.springsource.repository.bundles.release</id>
<name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.external</id>
<name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/external</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Built-By>Tobias Placht</Built-By>
<Bundle-ActivationPolicy>lazy</Bundle-ActivationPolicy>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<configuration>
<instructions>
<Export-Package>{local-packages};version="${project.version}"</Export-Package>
<Import-Package>*</Import-Package>
<Private-Package>{local-packages}</Private-Package>
<Service-Component>*</Service-Component>
</instructions>
</configuration>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.12.4</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.ops4j</groupId>
<artifactId>maven-pax-plugin</artifactId>
<version>1.5</version>
<configuration>
<provision>
<param>--profiles=ds</param>
<param>--platform=equinox</param>
<param>mvn:de.hswt.oms/workspace-datastructure-core/0.0.1-SNAPSHOT@2</param>
<param>mvn:de.hswt.oms/workspace-command-core/0.0.1-SNAPSHOT@2</param>
<param>mvn:de.hswt.oms/workspace-facade/0.0.1-SNAPSHOT@6</param>
</provision>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.6</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>1.0.7</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.7</version>
</dependency>
<dependency>
<groupId>org.junit</groupId>
<artifactId>com.springsource.org.junit</artifactId>
<version>4.11.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<modules>
<module>workspace-datastructure-core</module>
<module>workspace-command-core</module>
<module>workspace-log-config</module>
<module>workspace-wsr-create</module>
<module>workspace-datastructure-local</module>
<module>workspace-localfile-create</module>
<module>workspace-localfolder-create</module>
<module>workspace-facade</module>
<module>workspace-osgiframework-tests</module>
</modules>
}
以及相应的pom.xml
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<artifactId>workspace-osgiframework-tests</artifactId>
<properties>
<exam.version>2.5.0</exam.version>
<url.version>1.4.0</url.version>
</properties>
<parent>
<groupId>de.hswt.oms</groupId>
<artifactId>workspace-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<build>
<plugins>
<!-- skip plugin execution explicitly -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-forked</artifactId>
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit4</artifactId>
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-link-mvn</artifactId>
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-aether</artifactId>
<version>${url.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>4.0.2</version>
<scope>test</scope>
</dependency>
</dependencies>
你知道怎么摆脱它吗
此外,这是我的第一个maven项目,如果您有任何建议,请告诉我。当您刚接触maven和Pax考试时,我建议您尽可能坚持默认设置 并行使用maven jar插件和maven bundle插件可能会导致您看到的冲突。将bundle项目的Maven打包更改为“bundle”,并让Maven bundle插件生成清单。通常根本不需要直接使用maven jar插件 pax考试2.x不再支持maven pax插件。您应该在
@Configuration
方法中使用bundle()
选项
对于最新的示例,请看一下Pax考试自己的集成测试。有点离题:如果可能,您应该摆脱ApacheFelix依赖项,并根据osgi核心或概要包使用相应的依赖项替换它。这可以确保您不会意外地使用非标准功能,并允许您稍后切换到equinox或任何其他容器。我正在使用maven pax插件将我的包配置到OSGi容器中,而不是与pax考试一起使用。将包装从一个jar更改为另一个包解决了我的问题。非常感谢。
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<artifactId>workspace-osgiframework-tests</artifactId>
<properties>
<exam.version>2.5.0</exam.version>
<url.version>1.4.0</url.version>
</properties>
<parent>
<groupId>de.hswt.oms</groupId>
<artifactId>workspace-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<build>
<plugins>
<!-- skip plugin execution explicitly -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-container-forked</artifactId>
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-junit4</artifactId>
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.exam</groupId>
<artifactId>pax-exam-link-mvn</artifactId>
<version>${exam.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ops4j.pax.url</groupId>
<artifactId>pax-url-aether</artifactId>
<version>${url.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>4.0.2</version>
<scope>test</scope>
</dependency>
</dependencies>
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.546s
[INFO] Finished at: Fri Dec 14 15:37:50 CET 2012
[INFO] Final Memory: 27M/233M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.4:jar (default-jar) on project workspace-osgiframework-tests: Error assembling JAR: Manifest file: /home/knacht/development/repositorys/git/oms/workspace-parent/workspace-osgiframework-tests/target/classes/META-INF/MANIFEST.MF does not exist. -> [Help 1]