.bnd文件在IntelliJ中构建时出错

时间:2019-07-18 10:37:48

标签: java intellij-idea osgi apache-felix bnd

当我在IntelliJ中构建项目时,我的每个.bnd文件都出现错误(没有其他类型的错误)。

我开始研究一个新项目,该项目对我的同事没有任何问题(他们太忙了,无法帮助我进行设置)。 到目前为止,我所做的是:
-获取代码并将其作为IntelliJ中的Maven项目导入(无错误)
-从终端清洁安装(无错误)
-从IntelliJ构建项目(425个错误-每个.bnd文件大约2个错误)
-我尝试禁用OSGi插件(dmServerSupport和Spring OSGi)
-我曾尝试禁用Inspection OSGi配置文件
-我尝试将文件添加到编译器中->排除(仍构建)

该如何消除所有这些错误?

我的OSGi清单(如下所示:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Goodies
Bundle-SymbolicName: com.....osgi.goodies
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: ...
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: org.osgi.framework;version="1.7.0",
 org.osgi.service.component.annotations;version="1.2.0",
 org.osgi.service.event;version="1.3.0",
 org.osgi.service.packageadmin;version="1.2.0"

例如,我有这个.bnd文件:

-classpath: target/classes 
-dsannotations: *
Include-Resource: README.HTML
Private-Package: com.....pubsub.impl
Export-Package: com.....pubsub
-dsannotations: *

对于上面的文件,出现以下错误:

Error:osgi: [pubsub] Invalid Manifest header: -classpath, pattern=[A-Za-z0-9][-a-zA-Z0-9_]+
Error:osgi: [pubsub] Invalid Manifest header: -dsannotations, pattern=[A-Za-z0-9][-a-zA-Z0-9_]+

另一个示例:

-classpath: target/classes
-dsannotations: * 
Include-Resource: README.HTML
Private-Package: com.....security.thread.impl
Export-Package: com.....security.thread
Import-Package: oracle.jdbc;version=0,\
    *

从上面构建包含.bnd文件的项目将导致以下错误:

Error:osgi: [security.thread] Exception: java.io.IOException: invalid header field
    at java.util.jar.Attributes.read(Attributes.java:406)
    at java.util.jar.Manifest.read(Manifest.java:199)
    at java.util.jar.Manifest.<init>(Manifest.java:69)
    at aQute.bnd.osgi.Builder.build(Builder.java:116)
    at org.jetbrains.osgi.jps.build.BndWrapper.doBuild(BndWrapper.java:262)
    at org.jetbrains.osgi.jps.build.BndWrapper.build(BndWrapper.java:192)
    at org.jetbrains.osgi.jps.build.OsgiBuildSession.doBuild(OsgiBuildSession.java:211)
    at org.jetbrains.osgi.jps.build.OsgiBuildSession.build(OsgiBuildSession.java:79)
    at org.jetbrains.osgi.jps.build.OsmorcBuilder.build(OsmorcBuilder.java:54)
    at org.jetbrains.osgi.jps.build.OsmorcBuilder.build(OsmorcBuilder.java:33)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildTarget(IncProjectBuilder.java:1023)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1004)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1065)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:956)
    at org.jetbrains.jps.incremental.IncProjectBuilder.access$500(IncProjectBuilder.java:73)
    at org.jetbrains.jps.incremental.IncProjectBuilder$BuildParallelizer.lambda$queueTask$0(IncProjectBuilder.java:927)

0 个答案:

没有答案