maven 打包中MANIFEST的理解

下面这个插件里,我有几个地方不理解

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                        <classpathPrefix>lib/</classpathPrefix>
                        <mainClass>com.App</mainClass>
                    </manifest>
                    <!-- 给清单文件添加键值对(配置文件外置) -->
                    <manifestEntries>
                        <Class-Path>config/</Class-Path>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>
 

这三项:

 <addClasspath>true</addClasspath>
 <classpathPrefix>lib/</classpathPrefix>  
 <Class-Path>config/</Class-Path> 
    

1 如果第一项不是true,而是false,有何影响?
2 为何lib是classpathPrefix, config/是Class-Path, 区别是啥?

阅读 8.1k
1 个回答

jar 包方式可以通过Class-Path 追加类路径,不至于让程序发生 ClassNotFoundException

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题