我的工作了,和这里的细节:
首先,有没有办法来指定文件包括或排除如果使用内置的装配描述JAR-与依赖关系。
装配插件文档给出样本jar-with-dependencies descriptor here。
我将该描述符复制并粘贴到名为exec-jar.xml的项目目录中的文件中。然后在pom中,我改变了程序集插件以引用该描述符。下面是摘录:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-3</version>
<configuration>
<descriptors>
<descriptor>exec-jar.xml</descriptor>
</descriptors>
<archive>
<manifest>
<mainClass>com.package.MyMainClass</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
描述的该位结合的组件生命周期的包装阶段,并引用EXEC-jar.xml描述符。做这个包确认了jar是和预定义的描述符一起构建的。
然后,它成为修改exec-jar.xml来排除与Spring文件冲突的CXF文件的问题。这是我的装配描述符,它完成了:
<assembly>
<id>jar-with-dependencies</id>
<formats>
<format>jar</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<dependencySets>
<dependencySet>
<unpack>true</unpack>
<unpackOptions>
<excludes>
<exclude>cxf*/META-INF/spring.handlers</exclude>
<exclude>cxf*/META-INF/spring.schemas</exclude>
</excludes>
</unpackOptions>
<scope>runtime</scope>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>${project.build.outputDirectory}</directory>
</fileSet>
</fileSets>
</assembly>
现在,这里是蹭。如果使用当前发布的汇编插件2.1版进行此操作,它将在标签上以“意外”方式失败。标签在插件的未发布版本2.2中受支持。请注意,在我上面的pom文件摘录中,我指定了maven-assembly-plugin版本2.2-beta-3,这是本文写作时的最新版本。
这成功地构建了一个可执行的jar,并且Spring拥有了初始化我的应用程序所需的所有处理程序和模式。
同样的事情发生与“spring.tooling”的文件,但是从他们的名字我猜他们不是在运行时使用。 – 2010-10-12 05:12:08