繁体   English   中英

在maven pom.xml中使用带有classpathPrefix的子目录

[英]Use subdirectories with classpathPrefix in maven pom.xml

我正在使用以下内容在我的maven pom.xml中构建一个类路径

                    <manifest>
                        <addClasspath>true</addClasspath>
                        <classpathPrefix>lib/</classpathPrefix> 
                    </manifest>

'lib'下有一个目录,我也想添加到类路径中但它似乎没有找到它。

有没有办法做到这一点?

你不能用jar插件做到这一点。 尝试组装插件,它更灵活

如果要在Manifest文件中向Class-Path添加目录,可以在pom.xml中添加这样的内容。

 <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
        <configuration>
            <archive>
                <manifest>
                    <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                    <addClasspath>true</addClasspath>
                    <mainClass>your_main_class</mainClass>
                </manifest>
                <manifestEntries>
                    <Class-Path>lib/myfolder/</Class-Path>
                </manifestEntries>
            </archive>
        </configuration>
   </plugin>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM