从使用Maven构建Spring项目迁移到使用gradle构建它之后,我发现了奇怪的空验证错误。
我注意到路径src/main/webapp/WEB-INF/classes
位于Web App Libraries
构建路径组下,但是使用Maven-import配置它只是在src目录中。
使用gradle cleanEclipse
,刷新和清除项目,也不删除所有.metadata
,.settings
,bin
,.classpath
,.project
目录帮助。
除了WAR文件构建正常。
配置:
//----------------------------------------------------------------------------
// SERVER'S TASKS' CONFIGURATION
//----------------------------------------------------------------------------
configure(serverProjects) {
apply plugin : 'war'
apply plugin : 'eclipse-wtp'
sourceCompatibility = 1.7
targetCompatibility = 1.7
}
project(':Server') {
war {
destinationDir serverDir
}
}
...
//----------------------------------------------------------------------------
// SERVER'S PROJECTS' CONFIGURATION
//----------------------------------------------------------------------------
project(':Server') {
eclipse {
project {
natures "com.springsource.sts.gradle.core.nature"
}
classpath {
containers "com.springsource.sts.gradle.classpathcontainer"
}
}
}
...
//----------------------------------------------------------------------------
// SERVER'S DEPENDENCIES' CONFIGURATION
//----------------------------------------------------------------------------
configure(serverProjects) {
repositories {
mavenCentral()
maven { url 'https://repository.jboss.org/nexus/content/groups/public' }
}
}
project(':Server') {
dependencies {
...
}
}
如果没有此问题,我该怎么做才能确保将项目导入Eclipse?
编辑:
我可以看到的唯一信息是:empty validation error http://img689.imageshack.us/img689/2682/vaildationerror.png
据我所知,maven的项目构建没有任何错误,只有少量警告。现在我看到简单<form:errors path="field"/>
对“列表是通用的”感到愤怒。
EDIT2:
我设法通过将项目配置更改为:
来解决一些问题//----------------------------------------------------------------------------
// SERVER'S PROJECTS' CONFIGURATION
//----------------------------------------------------------------------------
project(':Server') {
eclipse {
project {
natures "org.springframework.ide.eclipse.core.springnature"
buildCommand "org.springframework.ide.eclipse.core.springbuilder"
}
}
}
但主要问题 - 验证错误,没有关于它的相关信息 - 仍然存在。
答案 0 :(得分:8)
我有同样的问题(我认为)。我通过右键单击项目并选择“验证”来解决它。这重新执行了验证并清除了错误。
答案 1 :(得分:2)
在警告清理期间,我决定删除文件src/test/resources/log4j.xml
,因为它是src/main/resources/log4j.xml
的复制品。在那一刻,空验证错误消失了。
如果其他人得到类似的错误,他应该试图摆脱所有警告,因为显然他们能够使项目失败的Eclipse验证。