我正在尝试创建一个实现'ModelResolver'接口的类 见http://maven.apache.org/ref/3.0.4/maven-model-builder/apidocs/org/apache/maven/model/resolution/ModelResolver.html
这是班级
class MyResolver implements ModelResolver {
private final File artifactFile;
public MyResolver(File artifactFile) {
this.artifactFile = artifactFile;
}
@Override
public void addRepository(Repository arg0)
throws InvalidRepositoryException {
/** Nothing to do here as aether will take care of this. */
}
@Override
public void addRepository(Repository arg0, boolean arg1)
throws InvalidRepositoryException {
/** Nothing to do here as aether will take care of this. */
}
@Override
public ModelResolver newCopy() {
return this;
}
@Override
public ModelSource resolveModel(Parent parent)
throws UnresolvableModelException {
Artifact artifact;
try {
/** Use parent class getRemoteArtifact method */
artifact = getRemoteArtifact(parent.getGroupId(),
parent.getArtifactId(),
parent.getVersion(),
"pom");
} catch (ArtifactResolutionException e) {
throw new UnresolvableModelException(e.getMessage(),
parent.getGroupId(),
parent.getArtifactId(),
parent.getVersion());
}
return new FileModelSource(artifact.getFile());
}
@Override
public ModelSource resolveModel(String groupId,
String artifactId,
String version)
throws UnresolvableModelException {
return new FileModelSource(artifactFile);
}
}
这给了我以下错误
The method addRepository must override the super class method.
我在java 1.7上使用eclipse进行开发。我错过了什么? 我还验证了eclipse中编译器合规性级别设置为1.7