私はルートpom.xmlファイルにVaadinライブラリ依存関係を持ついくつかのMavenモジュールを持っています。MAven + BNDによって生成されたOSGIバンドルからGWT依存コードを除外する方法は?
Maven + BNDを使用してOSGIバンドル(Mavenモジュールごとに1セット)を構築しようとしています。
私は私の "ルート" pom.xmlファイルにこれを追加しました:
残念ながら<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin</artifactId>
<version>6.6.6</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
、結果のJARファイル(バンドル)は、GWT(com.google.gwt)のクラスが含まれます。この 1)は、バンドルを巨大にし、多くの重複した依存関係を作ります。 2)「分割パッケージ」に関する数千のビルド警告が生成されました。
質問:JARファイルにGWTクラスを追加しないようにするにはどうすればよいですか?
GWTの「スコープ」を「提供」に設定し、「タイプ」を「バンドル」に設定してみましたが、オプション= trueでも設定できませんでした。ここ
はVaadin/GWTのものに責任がある私の根のpom.xmlの一部です:
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.5</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>mycompany.*</Export-Package>
<Private-Package>*.impl.*</Private-Package>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<!-- <Bundle-Activator>com.alskor.publicpackage.MyActivator</Bundle-Activator>-->
</instructions>
</configuration>
</plugin>
<!-- Compiles your custom GWT components with the GWT compiler -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<!-- Version 2.1.0-1 works at least with Vaadin 6.5 -->
<version>2.3.0-1</version>
<configuration>
<!-- if you don't specify any modules, the plugin will find them -->
<!--modules>
..
</modules-->
<webappDirectory>${project.build.directory}/${project.build.finalName}/VAADIN/widgetsets
</webappDirectory>
<extraJvmArgs>-Xmx512M -Xss1024k</extraJvmArgs>
<runTarget>clean</runTarget>
<hostedWebapp>${project.build.directory}/${project.build.finalName}</hostedWebapp>
<noServer>true</noServer>
<port>8080</port>
</configuration>
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Updates Vaadin 6.2+ widgetset definitions based on project dependencies -->
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<configuration>
<!-- if you don't specify any modules, the plugin will find them -->
<!--
<modules>
<module>${package}.gwt.MyWidgetSet</module>
</modules>
-->
</configuration>
<goals>
<goal>update-widgetset</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
この "mycompany。*"パターンをルートファイルに定義することはできず、すべてのモジュールにBND設定ファイルが必要ですか? – Alex
また、何らかの理由で、依存関係 "type = bundle"がビルドされたJARファイルに含まれないと予想されましたが、間違いがあります。 Mavenの依存関係を「バンドル」に設定すると、パッケージ化に影響はありません。 BNDが依存関係からファイルをロードする方法に影響するかもしれませんが、私は知らない... – Alex
あなたの最初の質問に答えて...これは議論の問題です。私の意見では、輸出パッケージは非常に重要であり、常に明示的かつ管理された方法で行われるべきです。これらは、あなたが消費者に提供するAPIなので、維持管理、バージョン管理などが必要です。プライベートパッケージはプライベートなのであまり心配はありませんが、ここでのワイルドカードは依然としてエラーの原因です。これらの使用方法については、Maven Bundle Pluginのドキュメントをよくお読みください! –