【问题标题】:Cannot find JRecord dependency for file conversion from Cobol找不到用于从 Cobol 进行文件转换的 JRecord 依赖项
【发布时间】:2019-06-27 08:34:57
【问题描述】:

我有一段代码,其中包含 JRecord 相关组件,Maven 找不到 cb2xml 的依赖项,所以所有代码都是红色的。我在互联网上寻找信息,但找不到太多信息。所以ICobolIOBuilderJRecordInterface1和所有与JRecord相关的东西都找不到了。

我将发布我的代码,任何人都可以帮助我解决依赖关系吗?

final ICobolIOBuilder ioBldr = JRecordInterface1.COBOL
        .newIOBuilder(copyBookFile)
        .setFont("cp273")
        .setDialect(ICopybookDialects.FMT_MAINFRAME);

final AbstractLineReader reader = ioBldr.newReader(dataFile);
AbstractLine l;

while ((l = reader.read()) != null) {

    System.out.println(">>>>>" + l.getFullLine());
    System.out.print("<<<<<");

    final FieldIterator iter = l.getFieldIterator(0);
    while (iter.hasNext()) {
        final AbstractFieldValue field = iter.next();
        System.out.print("|" + field.getFieldDetail().getName() + "=" + field.asString());
    }
    System.out.println("");

}

reader.close();

我拥有的与Cobol相关的依赖有:

<dependency>
    <groupId>net.sf.cobol2j</groupId>
    <artifactId>cobol2j</artifactId>
    <version>1.5.4</version>
</dependency>

<dependency>
    <groupId>commons-lang</groupId>
    <artifactId>commons-lang</artifactId>
    <version>2.6</version>
</dependency>

【问题讨论】:

    标签: java dependencies cobol jrecord


    【解决方案1】:

    你需要先用maven构建cb2xml

    如果您从 Source Forge 下载了JRecord,cb2xml 的源代码应该在 Source\OtherSource\cb2xml_package 目录中。

    获取 cb2xml 源的其他选项是

    【讨论】:

    • 谢谢,成功了!我现在的代码也有问题:我在 final AbstractLineReader reader = ioBldr.newReader(dataFile) 的行中得到“.NoSuchElementException”;当我调试时,它到达文件 CblIOBuilderMultiSchemaBase 和 if (copybooks.size( ) == 1) { return copybooks.get(0).createExternalRecord();,不能创建外部记录。你知道为什么吗?
    • 你应该接受这个答案。我不知道是什么导致了 NoSuchElementException;建议在 JRecord 项目上发帖;请指定您使用的版本
    【解决方案2】:

    请在 pom.xml 文件中添加以下依赖

         <dependency>
            <groupId>net.sf</groupId>
            <artifactId>jrecord</artifactId>
            <version>0.90.2</version>
        </dependency
    

    添加存储库:

        <repositories>
            <repository>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
                <id>central</id>
                <name>maven2</name>
                <url>https://repo.maven.apache.org/maven2</url>
            </repository>
    
            <repository>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
                <id>pentaho</id>
                <name>omni</name>
                <url>https://nexus.pentaho.org/content/groups/omni</url>
            </repository>
    </repositories>
    

    它将从 Pentaho 下载所有必要的文件 现在您可以进行 maven 更新和 maven 全新安装

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-20
      • 2022-12-18
      • 2013-11-02
      • 1970-01-01
      • 2011-01-24
      相关资源
      最近更新 更多