Univocity解析器“无法解析方法writeValue(int)”?

问题描述:

单义性分析器,“无法解析方法writeValue(INT)”出现用下面的代码,在的IntelliJ打开,任何帮助将不胜感激:Univocity解析器“无法解析方法writeValue(int)”?

public void write(){ 

     // Writing to an in-memory byte array. This will be printed out to the standard output so you can easily see the result. 
     ByteArrayOutputStream csvResult = new ByteArrayOutputStream(); 

     // CsvWriter (and all other file writers) work with an instance of java.io.Writer 
     Writer outputWriter = new OutputStreamWriter(csvResult); 

     TsvWriter writer = new TsvWriter(outputWriter, new TsvWriterSettings()); 

     writer.writeHeaders("A", "B", "C", "D", "E"); 

     //writes a value to the first column 
     writer.writeValue(10); 

     //writes a value to the second column 
     writer.writeValue(20); 

     //writes a value to the fourth column (index 3 represents the 4th column - the one with header "D") 
     writer.writeValue(3, 40); 

     //overrides the value in the first column. "A" indicates the header name. 
     writer.writeValue("A", 100.0); 

     //flushes all values to the output, creating a row. 
     writer.writeValuesToRow(); 
    } 

看来你得到了使用内置的例子此示例2.0.0-SNAPSHOT版本。更新您的pom.xml使用

<dependency> 
    <groupId>com.univocity</groupId> 
    <artifactId>univocity-parsers</artifactId> 
    <version>2.0.0-SNAPSHOT</version> 
</dependency> 

您可能还需要以下内容添加到您的pom.xml在使行家拿起快照建立:

<repositories> 
    <repository> 
     <id>ossrh</id> 
     <url>https://oss.sonatype.org/content/repositories/snapshots</url> 
    </repository> 
</repositories> 

如果你不使用Maven的你可以请直接转至以下网址:https://oss.sonatype.org/content/repositories/snapshots/com/univocity/univocity-parsers/2.0.0-SNAPSHOT/

最后,此示例取自快照版本,您之后的方法已重命名为addValue。检查示例here

+0

嗯,从该链接添加univocity-parsers-2.0.0-20151116.050805-20.jar到项目的库,IntelliJ仍然不能解决'writeValue'这个语句'writer.writeValue(10);' – 65535

+0

你有一个旧的快照。滚动到页面底部以获取最新信息:https://oss.sonatype.org/content/repositories/snapshots/com/univocity/univocity-parsers/2.0.0-SNAPSHOT/univocity-parsers-2.0.0- 20160115.024244-24.jar –

+0

嗯,这个链接是https://oss.sonatype.org/content/repositories/snapshots/com/univocity/univocity-parsers/2.0.0-SNAPSHOT/univocity-parsers-2.0.0-20160115.024244 -24.jar'生成一个404,有没有工作链接?,谢谢。 – 65535