Package org.apache.maven.plugin.war

Examples of org.apache.maven.plugin.war.Overlay


        // refer to a valid artifact
        final List<Artifact> configuredWarArtifacts = new ArrayList<Artifact>();
        final ListIterator<Overlay> it = overlays.listIterator();
        while ( it.hasNext() )
        {
            Overlay overlay = (Overlay) it.next();
            if ( overlay == null )
            {
                throw new InvalidOverlayConfigurationException( "overlay could not be null." );
            }
            // If it's the current project, return the project instance
            if ( overlay.isCurrentProject() )
            {
                overlay = currentProjectOverlay;
                it.set( overlay );
            }
            // default includes/excludes - only if the overlay uses the default settings
            if ( Arrays.equals( Overlay.DEFAULT_INCLUDES, overlay.getIncludes() )
                && Arrays.equals( Overlay.DEFAULT_EXCLUDES, overlay.getExcludes() ) )
            {
                overlay.setIncludes( defaultIncludes );
                overlay.setExcludes( defaultExcludes );
            }

            final Artifact artifact = getAssociatedArtifact( overlay );
            if ( artifact != null )
            {
                configuredWarArtifacts.add( artifact );
                overlay.setArtifact( artifact );
            }
        }

        // Build the list of missing overlays
        for ( Artifact artifact : artifactsOverlays )
        {
            if ( !configuredWarArtifacts.contains( artifact ) )
            {
                // Add a default overlay for the given artifact which will be applied after
                // the ones that have been configured
                overlays.add( new DefaultOverlay( artifact, defaultIncludes, defaultExcludes ) );
            }
        }

        // Final validation, make sure that the current project is in there. Otherwise add it first
        for ( Overlay overlay : overlays )
        {
            if ( overlay.equals( currentProjectOverlay ) )
            {
                return;
            }
        }
        overlays.add( 0, currentProjectOverlay );
View Full Code Here


    {
        final MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
        final List<Overlay> overlays = new ArrayList<Overlay>();
        try
        {
            final Overlay currentProjectOVerlay = Overlay.createInstance();
            OverlayManager manager = new OverlayManager( overlays, project, DEFAULT_INCLUDES, DEFAULT_EXCLUDES,
                                                         currentProjectOVerlay );
            assertNotNull( manager.getOverlays() );
            assertEquals( 1, manager.getOverlays().size() );
            assertEquals( currentProjectOVerlay, manager.getOverlays().get( 0 ) );
View Full Code Here

        final List<Overlay> overlays = new ArrayList<Overlay>();

        try
        {
            final Overlay overlay = currentProjectOverlay;
            OverlayManager manager = new OverlayManager( overlays, project, DEFAULT_INCLUDES, DEFAULT_EXCLUDES,
                                                         overlay );
            assertNotNull( manager.getOverlays() );
            assertEquals( 2, manager.getOverlays().size() );
            assertEquals( overlay, manager.getOverlays().get( 0 ) );
View Full Code Here

        final List<Overlay> overlays = new ArrayList<Overlay>();
        overlays.add( new DefaultOverlay( first ) );

        try
        {
            final Overlay currentProjectOverlay = Overlay.createInstance();
            OverlayManager manager = new OverlayManager( overlays, project, DEFAULT_INCLUDES, DEFAULT_EXCLUDES,
                                                         currentProjectOverlay );
            assertNotNull( manager.getOverlays() );
            assertEquals( 2, manager.getOverlays().size() );
            assertEquals( Overlay.createInstance(), manager.getOverlays().get( 0 ) );
View Full Code Here

        final MavenProjectArtifactsStub project = new MavenProjectArtifactsStub();
        final ArtifactStub first = newWarArtifact( "test", "test-webapp" );
        project.addArtifact( first );

        final List<Overlay> overlays = new ArrayList<Overlay>();
        overlays.add( new Overlay( "test", "test-webapp-2" ) );

        try
        {
            final Overlay currentProjectOVerlay = Overlay.createInstance();
            new OverlayManager( overlays, project, DEFAULT_INCLUDES, DEFAULT_EXCLUDES, currentProjectOVerlay );
            fail( "Should have failed to validate an unknown overlay" );
        }
        catch ( InvalidOverlayConfigurationException e )
        {
View Full Code Here

        project.addArtifact( first );
        project.addArtifact( second );

        final List<Overlay> overlays = new ArrayList<Overlay>();
        overlays.add( new DefaultOverlay( first ) );
        final Overlay currentProjectOverlay = Overlay.createInstance();
        overlays.add( currentProjectOverlay );

        try
        {
            OverlayManager manager = new OverlayManager( overlays, project, DEFAULT_INCLUDES, DEFAULT_EXCLUDES,
View Full Code Here

        overlays.add( new DefaultOverlay( first ) );
        overlays.add( new DefaultOverlay( second ) );

        try
        {
            final Overlay currentProjectOverlay = Overlay.createInstance();
            OverlayManager manager = new OverlayManager( overlays, project, DEFAULT_INCLUDES, DEFAULT_EXCLUDES,
                                                         currentProjectOverlay );
            assertNotNull( manager.getOverlays() );
            assertEquals( 3, manager.getOverlays().size() );
            assertEquals( currentProjectOverlay, manager.getOverlays().get( 0 ) );
View Full Code Here

        // refer to a valid artifact
        final List<Artifact> configuredWarArtifacts = new ArrayList<Artifact>();
        final ListIterator<Overlay> it = overlays.listIterator();
        while ( it.hasNext() )
        {
            Overlay overlay = it.next();
            if ( overlay == null )
            {
                throw new InvalidOverlayConfigurationException( "overlay could not be null." );
            }
            // If it's the current project, return the project instance
            if ( overlay.isCurrentProject() )
            {
                overlay = currentProjectOverlay;
                it.set( overlay );
            }
            // default includes/excludes - only if the overlay uses the default settings
            if ( Arrays.equals( Overlay.DEFAULT_INCLUDES, overlay.getIncludes() )
                && Arrays.equals( Overlay.DEFAULT_EXCLUDES, overlay.getExcludes() ) )
            {
                overlay.setIncludes( defaultIncludes );
                overlay.setExcludes( defaultExcludes );
            }

            final Artifact artifact = getAssociatedArtifact( overlay );
            if ( artifact != null )
            {
                configuredWarArtifacts.add( artifact );
                overlay.setArtifact( artifact );
            }
        }

        // Build the list of missing overlays
        for ( Artifact artifact : artifactsOverlays )
        {
            if ( !configuredWarArtifacts.contains( artifact ) )
            {
                // Add a default overlay for the given artifact which will be applied after
                // the ones that have been configured
                overlays.add( new DefaultOverlay( artifact, defaultIncludes, defaultExcludes ) );
            }
        }

        // Final validation, make sure that the current project is in there. Otherwise add it first
        for ( Overlay overlay : overlays )
        {
            if ( overlay.equals( currentProjectOverlay ) )
            {
                return;
            }
        }
        overlays.add( 0, currentProjectOverlay );
View Full Code Here

  /**
   * @return
   * @throws CoreException
   */
  public List<Overlay> getOverlays() throws CoreException {
    Overlay currentProjectOverlay = Overlay.createInstance();
    currentProjectOverlay.setArtifact(mavenProject.getArtifact());
    OverlayManager overlayManager = null;
    List<Overlay> overlays = null;
    try {
      overlayManager = new OverlayManager(getConfiguredOverlays(),
                                                         mavenProject,
View Full Code Here

    boolean filtered = DomUtils.getBooleanChildValue(overlayNode, "filtered"); //$NON-NLS-1$
    boolean skip = DomUtils.getBooleanChildValue(overlayNode, "skip"); //$NON-NLS-1$
    String type = DomUtils.getChildValue(overlayNode, "type", "war"); //$NON-NLS-1$ //$NON-NLS-2$
    String targetPath = DomUtils.getChildValue(overlayNode, "targetPath", "/"); //$NON-NLS-1$ //$NON-NLS-2$

    Overlay overlay = new Overlay();
    overlay.setArtifactId(artifactId);
    overlay.setGroupId(groupId);
    overlay.setClassifier(classifier);
    if (exclusions== null || exclusions.length ==0) {
      overlay.setExcludes(getDependentWarExcludes());
    } else {
      overlay.setExcludes(exclusions);
    }
    if (inclusions== null || inclusions.length ==0) {
      overlay.setIncludes(getDependentWarIncludes());
    } else {
      overlay.setIncludes(inclusions);
    }
    overlay.setFiltered(filtered);
    overlay.setSkip(skip);
    overlay.setTargetPath(targetPath);
    overlay.setType(type);
   
    return overlay;
  }
View Full Code Here

TOP

Related Classes of org.apache.maven.plugin.war.Overlay

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.