문제

Is there any relationship between the bundles mentioned in the <dependencies> tag and the <Import-Package> tag? I mean if we don't define dependency, then maven-bundle-plugin can not find the packages in <Import-Package> tag?

도움이 되었습니까?

해결책

Maven uses the jars listed in the dependencies section to create a classpath. This class path is used by bnd (the engine in the maven bundle plugin) to analyze what your code is referring to through byte code analysis.

 maven dependency -> classpath -> bnd analysis -> import statements

다른 팁

Import-Package is used to refine the list of package imports which the maven bundle plugin generates automatically for you. For example, you could declare some imports optional, or add imports for classes which are only accessed by reflection. In most cases it shouldn't be necessary to specify anything at all for Import-Package since the default is * - that is, any external packages referenced in your bytecode will be imported.

The dependencies section provides the pool of bundles used by the compiler to generate the bytecode, and bnd (which is what the bundle plugin under the covers) to improve the package imports. For example, it will add version ranges based on the exported versions in a providing bundle in the dependencies list (or in transitive dependencies).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top