Appassembler在生成的脚本中构建错误的类路径

时间:2015-03-18 22:26:44

标签: java maven appassembler

我们在应用程序中使用了appassembler插件。我们正在使用分类器转换我们的maven配置来创建工件,这些分类器显示了用于编译它的jdk。在添加配置文件和构建分类jar之前,appassembler愉快地创建了一个脚本并构建了适当的类路径来支持脚本。

然而,现在使用分类器构建工件,它正在向其类路径添加错误的jar。也就是说,它引用了正确的groupId,artifactId和version,但没有分类器。如何让appassembler正确构建路径?

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>appassembler-maven-plugin</artifactId>
    <version>1.9</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>assemble</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <programs>
            <program>
                <mainClass>com.package.ObjectClass</mainClass>
                <name>ObjectClass</name>
            </program>
        </programs>
    </configuration>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>${maven.jar.version}</version>
    <configuration>
        <classifier>${jdk.version.display}</classifier>
    </configuration>
</plugin>

以下是显示问题的通用示例:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>example</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>appassembler-maven-plugin</artifactId>
            <version>1.9</version>
            <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>assemble</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <programs>
                    <program>
                        <mainClass>test.example.TestExample</mainClass>
                        <name>TestExample</name>
                    </program>
                </programs>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <version>2.4</version>
            <configuration>
                <classifier>myClassifier</classifier>
            </configuration>
        </plugin>
    </plugins>
</build>

0 个答案:

没有答案