validateStringNotEmpty( "version", result, model.getVersion() );
for ( Iterator it = model.getDependencies().iterator(); it.hasNext(); )
{
Dependency d = (Dependency) it.next();
validateId( "dependencies.dependency.artifactId", result, d.getArtifactId() );
validateId( "dependencies.dependency.groupId", result, d.getGroupId() );
validateStringNotEmpty( "dependencies.dependency.type", result, d.getType(), d.getManagementKey() );
validateStringNotEmpty( "dependencies.dependency.version", result, d.getVersion(), d.getManagementKey() );
if ( Artifact.SCOPE_SYSTEM.equals( d.getScope() ) )
{
String systemPath = d.getSystemPath();
if ( StringUtils.isEmpty( systemPath ) )
{
result.addMessage( "For dependency " + d + ": system-scoped dependency must specify systemPath." );
}
else
{
if ( ! new File( systemPath ).isAbsolute() )
{
result.addMessage( "For dependency " + d + ": system-scoped dependency must " +
"specify an absolute path systemPath." );
}
}
}
else if ( StringUtils.isNotEmpty( d.getSystemPath() ) )
{
result.addMessage(
"For dependency " + d + ": only dependency with system scope can specify systemPath." );
}
}
DependencyManagement mgmt = model.getDependencyManagement();
if ( mgmt != null )
{
for ( Iterator it = mgmt.getDependencies().iterator(); it.hasNext(); )
{
Dependency d = (Dependency) it.next();
validateSubElementStringNotEmpty( d, "dependencyManagement.dependencies.dependency.artifactId", result,
d.getArtifactId() );
validateSubElementStringNotEmpty( d, "dependencyManagement.dependencies.dependency.groupId", result,
d.getGroupId() );
if ( Artifact.SCOPE_SYSTEM.equals( d.getScope() ) )
{
String systemPath = d.getSystemPath();
if ( StringUtils.isEmpty( systemPath ) )
{
result.addMessage( "For managed dependency " + d + ": system-scoped dependency must specify systemPath." );
}
else
{
if ( ! new File( systemPath ).isAbsolute() )
{
result.addMessage( "For managed dependency " + d + ": system-scoped dependency must " +
"specify an absolute path systemPath." );
}
}
}
else if ( StringUtils.isNotEmpty( d.getSystemPath() ) )
{
result.addMessage(
"For managed dependency " + d + ": only dependency with system scope can specify systemPath." );
}
}