@ -32,6 +32,7 @@ import org.springframework.boot.loader.tools.Repackager;
* Repackage task .
* Repackage task .
*
*
* @author Phillip Webb
* @author Phillip Webb
* @author Janne Valkealahti
* /
* /
public class Repackage extends DefaultTask {
public class Repackage extends DefaultTask {
@ -41,6 +42,8 @@ public class Repackage extends DefaultTask {
private Object withJarTask ;
private Object withJarTask ;
private String mainClass ;
public void setCustomConfiguration ( String customConfiguration ) {
public void setCustomConfiguration ( String customConfiguration ) {
this . customConfiguration = customConfiguration ;
this . customConfiguration = customConfiguration ;
}
}
@ -49,6 +52,10 @@ public class Repackage extends DefaultTask {
this . withJarTask = withJarTask ;
this . withJarTask = withJarTask ;
}
}
public void setMainClass ( String mainClass ) {
this . mainClass = mainClass ;
}
@TaskAction
@TaskAction
public void repackage ( ) {
public void repackage ( ) {
Project project = getProject ( ) ;
Project project = getProject ( ) ;
@ -64,6 +71,7 @@ public class Repackage extends DefaultTask {
else if ( extension . getCustomConfiguration ( ) ! = null ) {
else if ( extension . getCustomConfiguration ( ) ! = null ) {
libraries . setCustomConfigurationName ( extension . getCustomConfiguration ( ) ) ;
libraries . setCustomConfigurationName ( extension . getCustomConfiguration ( ) ) ;
}
}
project . getTasks ( ) . withType ( Jar . class , new Action < Jar > ( ) {
project . getTasks ( ) . withType ( Jar . class , new Action < Jar > ( ) {
@Override
@Override
@ -99,7 +107,9 @@ public class Repackage extends DefaultTask {
}
}
} ;
} ;
} ;
} ;
repackager . setMainClass ( extension . getMainClass ( ) ) ;
repackager
. setMainClass ( Repackage . this . mainClass ! = null ? Repackage . this . mainClass
: extension . getMainClass ( ) ) ;
if ( extension . convertLayout ( ) ! = null ) {
if ( extension . convertLayout ( ) ! = null ) {
repackager . setLayout ( extension . convertLayout ( ) ) ;
repackager . setLayout ( extension . convertLayout ( ) ) ;
}
}