我一直在嘗試在一個osgi包的項目中使用querydsl。 我的pom.xml具有以下依存關係:在osgi中使用QueryDSL
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>2.5.0</version>
</dependency>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-jpa</artifactId>
<version>2.5.0</version>
</dependency>
除了插件
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>maven-apt-plugin</artifactId>
<version>0.3.2</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.ops4j</groupId>
<artifactId>maven-pax-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<!-- | the following instructions build a simple set of public/private
classes into an OSGi bundle -->
<configuration>
<instructions>
<Import-Package>com.mysema.query.jpa,*</Import-Package>
<Export-Package>com.mypackage.package.*;version="${project.version}"</Export-Package>
</instructions>
</configuration>
</plugin>
不過,當我嘗試啓動捆綁我得到:
Error executing command: Unresolved constraint in bundle com.mypackage.package [163]: Unable to resolve 163.0: missing requirement [163.0] package; (&(package=com.mysema.query.jpa)(version>=2.5.0)(!(version>=3.0.0)))
我正在使用querydsl的舊版本,但顯然他們最近修復了一些stuff about osgi,所以我升級了。問題依然存在。
我缺少querydsl在osgi內部工作嗎?
querydsl-jpa bundle有很多依賴(直接和瞬態),我假設你已經加載了所有這些,並且querydsl-jpa bundle已啓動? – earcam
沒有。你是對的。我是osgi的新手,並且我假定在karaf控制檯中執行osgi:instal mvn .....我會解決所有依賴關係。顯然不是 – santiagozky