我一直在将我的开发环境更新为 Eclipse Neon 并引入 m2e 来管理项目依赖项。在一个项目中,原始(非常旧的)版本JFreeChart
在 maven 上不可用,所以我放入了最新版本的JFreeChart
和JCommon
.
我现在有一个编译错误,如下所述:
The type org.jfree.data.general.Series cannot be resolved.
It is indirectly referenced from required .class files.
我发现了许多关于此的问题和答案,但它们似乎与JCommon
. 我有JCommon
我的依赖项,并且我检查了所引用的特定类实际上是在jfreechart.jar
带有 7-zip 的文件中。下面是有错误的代码片段,它发生在最后一个 else 语句中results.add(…)
。
public XYDataset getMetricHistogramData(Timestamp t1, Timestamp t2){
int index1=-1;
Timestamp startTime,endTime;
TimePeriodValues results = new TimePeriodValues(this.type.name());
final TimePeriodValuesCollection results1 = new TimePeriodValuesCollection();
if (t1.before(earliest)||t1.after(latest)||(readings.size()<=1)) return null; // won't find a value for the timestamp t1
if (t2.before(earliest)||t2.after(latest)) return null; // won't find a value for the timestamp t2
for(int i = 0;i<readings.size();i++){
if (readings.get(i).timestamp().equals(t1)){
index1=i;
break;
}
if (readings.get(i).timestamp().after(t1)){
index1=i-1;
break;
}
}
// index1 now contains the index of the starting timestamp
for (int i=index1; i<(readings.size()-1); i++){
startTime = readings.get(i).timestamp();
if(startTime.after(t2)) break;
//endTime = new Timestamp(Math.abs(readings.get(i+1).timestamp().getTime()-Timestamped.SECOND_IN_MS));
endTime = readings.get(i+1).timestamp();
if (endTime.before(startTime))
SmartPower.getMain().getFrame().displayLog("Bad Timestamps "+startTime + " - " + endTime+"\n\r");
else results.add(new SimpleTimePeriod(startTime, endTime), readings.get(i).value());
}
results1.addSeries(results);
return results1;
}
这是我的 pom.xml 文件
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>SmartPower</groupId>
<artifactId>SmartPower</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.eclipse.persistence/javax.persistence -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jfree/jfreechart -->
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.19</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jfree/jcommon -->
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jcommon</artifactId>
<version>1.0.23</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.jgoodies/forms -->
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>forms</artifactId>
<version>1.2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.derby/derby -->
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.12.1.1</version>
</dependency>
</dependencies>
</project>
大约一周前,Neon 在 Windows 10 上进行了全新安装。
任何指针将不胜感激。