gpt4 book ai didi

java - 为什么ant Manifest任务会分割长主类名?

转载 作者:行者123 更新时间:2023-11-30 05:34:17 25 4
gpt4 key购买 nike

以下是我的 Ant 构建文件内容:

<?xml version="1.0"?>
<project name="testant"
basedir=".">
<property file="build.properties" />
<target name="manifest">
<tstamp />
<manifest mode="update"
file="manifest.mf">
<attribute name="Built-By"
value="${user.name}" />
<section name="common">
<attribute name="Specification-Title"
value="${ant.project.name}" />
<attribute name="Specification-Version"
value="1.0.0" />
<attribute name="Specification-Vendor"
value="" />
<attribute name="Implementation-Title"
value="" />
<attribute name="Implementation-Version"
value="${TODAY}" />
<attribute name="Implementation-Vendor"
value="" />
</section>
<attribute name="Main-Class"
value="${main.class}" />
</manifest>
</target>
</project>

以下是我的 build.properties。

packages=com.javacodegeeks.patterns.strategypattern.*
main.class=com.javacodegeeks.patterns.strategypattern.TestStrategyPattern

以下是我的输出manifest.mf。

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.10.6
Created-By: 10.0.2+13 (Oracle Corporation)
Built-By: root
Main-Class: com.javacodegeeks.patterns.strategypattern.TestStrategyPat
tern

Name: common
Specification-Title: testant
Specification-Version: 1.0.0
Specification-Vendor:
Implementation-Title:
Implementation-Version: July 7 2019
Implementation-Vendor:

为什么主类名中会产生空格?

它不影响使用 ant 任务或 jar 命令生成 jar 文件。

可执行 jar 也按预期工作。

最佳答案

According to the JAR specification ,

  • Line length:

    • No line may be longer than 72 bytes (not characters), in its UTF8-encoded form. If a value would make the initial line longer than this, it should be continued on extra lines (each starting with a single SPACE).

有些工具似乎忽略了这个要求,但 Ant 对此非常严格。您的行以 70 个字符换行,大概还加上 \r\n

关于java - 为什么ant Manifest任务会分割长主类名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56919452/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com