1

OSGI-INF/serviceComponent.xml は、次のような依存関係を追加することにより、maven scr felix プラグインを使用して生成できます。

<plugin>
    <groupId>org.apache.felix</groupId>
    <artifactId>maven-scr-plugin</artifactId>
    <version>1.15.0</version>
    <executions>
        <execution>
            <id>generate-scr-scrdescriptor</id>
            <goals>
                <goal>scr</goal>
            </goals>
        </execution>
    </executions>
</plugin>

しかし、gradleの場合、生成できません..追加しようとしました

buildscript {
dependencies {
    classpath group:'be.jlr-home.gradle' , name:'scrPlugin', version:'0.1.0'

}}
apply plugin: 'java'
`apply plugin: 'eclipse'
 apply plugin: 'maven'
 apply plugin: 'osgi'
   apply plugin: 'scr'

be.jlr-home.gradle が見つからないというエラーが発生しています。

私は何か間違ったことをしていますか?

基本的に、依存関係をgradleに追加してservicecomponent.xmlを生成する必要があります

4

3 に答える 3

0

問題を解決しました

以下の行をgradleファイルに追加すると機能します。

ant.properties.src = 'src/main/java'

ant.properties.classes = 'build/classes/main' task genscr(dependsOn: compileJava) << { println ant.properties.classes ant.taskdef(resource: 'scrtask.properties', classpath: configurations.compile.asPath) ant.scr(srcdir: ant.properties.src, destdir: ant.properties.classes, classpath: configurations.compile.asPath) }

jar.dependsOn(genscr)
jar {
manifest {


// version = '1.0'
       name = 'xxxxxxxxx'
      instruction 'Service-Component', 'OSGI-INF/<PKGNAME>.<CLASSNAME>.xml'    

}

dependencies {



 ......//All other dependencies........


 compile  'org.apache.felix:org.apache.felix.scr.annotations:1.9.8'
compile 'org.apache.felix:org.apache.felix.scr.ds-annotations:1.2.4'
compile  group: 'org.apache.felix', name: 'org.apache.felix.scr.ant', version: '1.110.'

}

sourceSets.main.compileClasspath += 構成.compile

于 2014-07-31T05:47:08.697 に答える
0

Maven pom スニペットは、scr の maven プラグインを felix から構成します。scr アノテーション処理には gradle プラグインが必要です。フェリックスが持っていることを知りません。bnd プロジェクトには gradle サポートが追加され (2.4.0.M1 には bnd 用の gradle プラグインが含まれています)、bnd は DS の注釈を処理できます (ただし、Felix のものではない可能性があります)。

于 2014-07-29T22:48:22.603 に答える