我已经pom.xml通过maven配置了所有依赖项。当我给出命令 build 时,出现以下错误
[错误] 无法在项目 nwt_thp_api_br_be-web 上执行目标 org.apache.maven.plugins:maven-war-plugin:2.4:war (default-war):目标 org.apache.maven.plugins:maven 的执行 default-war -war-plugin:2.4:war失败:由于API不兼容,无法加载插件“org.apache.maven.plugins:maven-war-plugin:2.4”中的mojo“war”:org.codehaus.plexus。 component.repository.exception.ComponentLookupException:null
我该如何解决这个问题?
我正在开发一个用于投票的 API。我有一个方法可以启动投票会话,并且会话应该开放 1 分钟,然后在一段时间后关闭。
关闭会话意味着我必须将方法更改setIsSessionOpen为FALSE.
当会话开放时,用户应该能够投票。在我的SessionVote对象内部有两个代表投票的字段(votedYes两个votedNo字段都将存储每个投票的计数)。
这是我到目前为止所做的,它是在服务类中:
public SessionVote openSession(String agendaSubject, Integer sessionId){
SessionVote sessionVote = findBySessionVoteId(sessionId);
Optional<Agenda> agenda = getAgendaBySubject(agendaSubject);
if (agenda.isPresent()) {
sessionVote.setAgenda(agenda.get());
sessionVote.setIsSessionOpen(true);
sessionVote.setStartedTime(System.currentTimeMillis());
LOGGER.info("The session ID {} is opened and started at {}. The subject for voting is: {}", sessionVote.getSessionVoteId(), sessionVote.getStartedTime(), sessionVote.getAgenda().getSubject());
return sessionVote;
} else {
LOGGER.error("No subject was found");
throw new NoSubjectFoundException(Constants.NO_SUBJECT_FOUND);
}
}
Run Code Online (Sandbox Code Playgroud)
我省略了一些代码,以便更清晰、更容易理解我的问题,但如果有必要,我可以添加更多信息。