@@ -74,6 +74,12 @@ public class UnpackMojo extends AbstractAndroidMojo
7474 @ ConfigPojo ( prefix = "unpack" )
7575 private Unpack unpack ;
7676
77+ @ Parameter ( defaultValue = "${project.build.directory}/android-classes" , readonly = true )
78+ private File unpackOutputDirectory ;
79+
80+ @ Parameter ( defaultValue = "false" , readonly = true )
81+ private boolean includeNonClassFiles ;
82+
7783 public void execute () throws MojoExecutionException , MojoFailureException
7884 {
7985
@@ -89,7 +95,7 @@ public void execute() throws MojoExecutionException, MojoFailureException
8995
9096 private File unpackClasses () throws MojoExecutionException
9197 {
92- File outputDirectory = new File ( targetDirectory , "android-classes" ) ;
98+ File outputDirectory = unpackOutputDirectory ;
9399 if ( lazyLibraryUnpack && outputDirectory .exists () )
94100 {
95101 getLog ().info ( "skip library unpacking due to lazyLibraryUnpack policy" );
@@ -141,7 +147,10 @@ public boolean include( JarEntry jarEntry )
141147
142148 try
143149 {
144- FileUtils .copyDirectory ( projectOutputDirectory , outputDirectory );
150+ if ( !projectOutputDirectory .equals ( outputDirectory ) )
151+ {
152+ FileUtils .copyDirectory ( projectOutputDirectory , outputDirectory );
153+ }
145154 }
146155 catch ( IOException e )
147156 {
@@ -160,6 +169,11 @@ boolean isIncluded( JarEntry jarEntry )
160169 return true ;
161170 }
162171
172+ if ( includeNonClassFiles && !entName .startsWith ( "META-INF/" ) )
173+ {
174+ return true ;
175+ }
176+
163177 return this .unpackMetaInf != null && this .unpackMetaInf .isIncluded ( entName );
164178 }
165179
0 commit comments