xenoterracide
05/10/2018, 2:19 AM@Override
public void apply( Project project ) {
if ( System.getenv( "JRS_S3_URI" ) != null ) {
<http://log.info|log.info>( "publishing to: {}", System.getenv( "JRS_S3_URI" ) );
project.getPluginManager().apply( MavenPublishPlugin.class );
TaskContainer tasks = project.getTasks();
project.getExtensions().configure( PublishingExtension.class, ext -> {
ext.repositories( repos -> {
repos.maven( repo -> {
repo.setUrl( URI.create( System.getenv( "JRS_S3_URI" ) ) );
repo.credentials( AwsCredentials.class, creds -> {
creds.setAccessKey( System.getenv( "JRS_ACCESSKEYID" ) );
creds.setSecretKey( System.getenv( "JRS_SECRETACCESSKEY" ) );
} );
} );
} );
ext.publications( pubs -> {
Jar sourceJar = tasks.create( "sources", Jar.class, jarTask -> {
getSourceSets().stream()
.map( SourceSet::getAllSource )
.map( sds -> project.copySpec().from( sds ) )
.forEach( copySpec -> jarTask.include( copySpec.getIncludes() ) );
} );
pubs.create( "private", MavenPublication.class, pub -> {
pub.from( project.getComponents().getAt( "java" ) );
/// pub.artifact( sourceJar );
} );
} );
} );
}
else {
<http://log.info|log.info>( "no repository to publish to defined" );
}
}