Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.codehaus.mojo.rpm;
  
  /*
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
  *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
 
 import java.util.List;
 
A description of the set of project dependencies to include in the mapping. If no includes or excludes are specified, all dependencies will be included in the mapping.

Each include or exclude should be specified in the form: "groupID:artifactID[ :version]" Any field can be specified as "*" which means any value is a match. If version is omitted (it usually is), it is the same as specifying "*".

 
 public class Dependency
 {
 
     // // // Properties
 
    
List of dependencies to include.
 
     private List<Artifactincludes;

    
List of dependencies to exclude.
 
     private List<Artifactexcludes;

    
Strip version is false by default.

Since:
2.0-beta-4
 
     private boolean stripVersion = false;
 
     // // // Bean methods
 
    
Retrieve the list of dependencies to include.

Returns:
The list of dependencies to include.
 
     public List<ArtifactgetIncludes()
     {
         return ;
     }

    
Set the list of dependencies to include.

Parameters:
incls The new list of dependencies to include.
Throws:
org.apache.maven.plugin.MojoExecutionException if the parse fails
 
     public void setIncludesList<Stringincls )
         throws MojoExecutionException
     {
          = parseListincls );
     }

    
Retrieve the list of dependencies to exclude.

Returns:
The list of dependencies to exclude.
 
     public List<ArtifactgetExcludes()
     {
         return ;
     }

    
Set the list of dependencies to exclude.

Parameters:
excls The new list of dependencies to exclude.
Throws:
org.apache.maven.plugin.MojoExecutionException if the parse fails
 
     public void setExcludesList<Stringexcls )
         throws MojoExecutionException
    {
         = parseListexcls );
    }

    
Retrieve the stripVersion property

Returns:
The stripVersion property
    public boolean getStripVersion()
    {
        return ;
    }

    
Set the stripVersion property

Parameters:
stripVersion
Throws:
org.apache.maven.plugin.MojoExecutionException if the parse fails
    public void setStripVersionboolean stripVersion )
        throws MojoExecutionException
    {
        this. = stripVersion;
    }
    // // // Public methods

    
    public String toString()
    {
        StringBuilder sb = new StringBuilder();
        sb.append"[dependencies" );
        if (  != null )
        {
            sb.append" include [" +  + "]" );
        }
        if (  != null )
        {
            sb.append" exclude [" +  + "]" );
        }
        sb.append" stripVersion (" +  + ")" );
        sb.append"]" );
        return sb.toString();
    }
    // // // Private methods

    
Parse the list of dependencies.

Parameters:
in The list specified in the configuration
Returns:
A list of parsed artifact identifiers
Throws:
org.apache.maven.plugin.MojoExecutionException if the parse fails
    private List<ArtifactparseListList<Stringin )
        throws MojoExecutionException
    {
        List<Artifactretval = new ArrayList<Artifact>();
        for ( String s : in )
        {
            // Make sure we have group and artifact
            int p1 = s.indexOf":" );
            if ( p1 == -1 )
            {
                throw new MojoExecutionException"Include and exclude must include both group and artifact IDs." );
            }
            // Find end of artifact and create version range
            int p2 = s.indexOf":", ( p1 + 1 ) );
            VersionRange vr = null;
            if ( p2 == -1 )
            {
                p2 = s.length();
                try
                {
                    vr = VersionRange.createFromVersionSpec"[0,]" );
                }
                catch ( InvalidVersionSpecificationException ex )
                {
                    throw new MojoExecutionException"Default version string is invalid!" );
                }
            }
            else
            {
                try
                {
                    vr = VersionRange.createFromVersionSpecs.substringp2 + 1 ) );
                }
                catch ( InvalidVersionSpecificationException ex )
                {
                    throw new MojoExecutionException"Version string " + s.substringp2 + 1 ) + " is invalid." );
                }
            }
            retval.addnew DefaultArtifacts.substring( 0, p1 ), s.substringp1 + 1, p2 ), vrnull""""null ) );
        }
        return retval;
    }
New to GrepCode? Check out our FAQ X