protected void validate()

in src/main/java/org/apache/maven/resolver/internal/ant/tasks/AbstractDistTask.java [46:88]


    protected void validate()
    {
        getArtifacts().validate( this );

        final Map<String, File> duplicates = new HashMap<String, File>();
        for ( final Artifact artifact : getArtifacts().getArtifacts() )
        {
            final String key = artifact.getType() + ':' + artifact.getClassifier();
            if ( "pom:".equals( key ) )
            {
                throw new BuildException( "You must not specify an <artifact> with type=pom"
                    + ", please use the <pom> element instead." );
            }
            else if ( duplicates.containsKey( key ) )
            {
                throw new BuildException( "You must not specify two or more artifacts with the same type ("
                    + artifact.getType() + ") and classifier (" + artifact.getClassifier() + ")" );
            }
            else
            {
                duplicates.put( key, artifact.getFile() );
            }

            validateArtifactGav( artifact );
        }

        final Pom defaultPom = AntRepoSys.getInstance( getProject() ).getDefaultPom();
        if ( pom == null && defaultPom != null )
        {
            log( "Using default POM (" + defaultPom.getCoords() + ")", Project.MSG_INFO );
            pom = defaultPom;
        }

        if ( pom == null )
        {
            throw new BuildException( "You must specify the <pom file=\"...\"> element"
                + " to denote the descriptor for the artifacts" );
        }
        if ( pom.getFile() == null )
        {
            throw new BuildException( "You must specify a <pom> element that has the 'file' attribute set" );
        }
    }