首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么ant Manifest任务拆分长主类名?

为什么ant Manifest任务拆分长主类名?
EN

Stack Overflow用户
提问于 2019-07-07 12:55:41
回答 1查看 172关注 0票数 1

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

代码语言:javascript
复制
<?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。

代码语言:javascript
复制
packages=com.javacodegeeks.patterns.strategypattern.*
main.class=com.javacodegeeks.patterns.strategypattern.TestStrategyPattern

以下是我的输出manifest.mf。

代码语言:javascript
复制
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也可以按预期工作。

EN

回答 1

Stack Overflow用户

发布于 2019-07-07 13:22:32

According to the JAR specification

  • 线路长度:

代码语言:javascript
复制
- 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

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56919452

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档