org.commonjava.maven.plugins.monolith.handler.SpringDefsHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of monolith-maven-plugin Show documentation
Show all versions of monolith-maven-plugin Show documentation
Maven plugin to generate self-contained versions of declared plugins and other artifacts.
The newest version!
package org.commonjava.maven.plugins.monolith.handler;
import org.codehaus.plexus.components.io.fileselectors.FileInfo;
import org.codehaus.plexus.logging.Logger;
import org.commonjava.maven.plugins.monolith.comp.MonolithVersioningContext;
public class SpringDefsHandler
extends AbstractAggregatingHandler
{
private static final String SPRING_PATH_PREFIX = "META-INF/";
public SpringDefsHandler( final MonolithVersioningContext monolithVersioningContext, final Logger logger )
{
super( monolithVersioningContext, logger );
}
@Override
protected String getOutputPathPrefix( final FileInfo fileInfo )
{
return SPRING_PATH_PREFIX;
}
@Override
protected boolean fileMatches( final FileInfo fileInfo )
{
final String path = fileInfo.getName();
String leftover = null;
if ( path.startsWith( "/META-INF/spring." ) )
{
leftover = path.substring( "/META-INF/spring.".length() );
}
else if ( path.startsWith( "META-INF/spring." ) )
{
leftover = path.substring( "META-INF/spring.".length() - 1 );
}
return leftover != null && leftover.length() > 0;
}
}