41
41
package org .glassfish .build ;
42
42
43
43
import java .io .File ;
44
+ import java .util .ArrayList ;
45
+ import java .util .Arrays ;
46
+ import java .util .List ;
44
47
import org .apache .maven .artifact .handler .ArtifactHandler ;
45
48
import org .apache .maven .plugin .AbstractMojo ;
46
49
import org .apache .maven .plugin .MojoExecutionException ;
@@ -99,23 +102,23 @@ public class ZipMojo extends AbstractMojo {
99
102
100
103
/**
101
104
* dir the root of the directory tree of the default FileSet ;
102
- * Only when not fileset(s) provided.
105
+ * Only when no fileset(s) provided.
103
106
*
104
107
* @parameter expression="${gfzip.dir}" default-value="${project.build.directory}"
105
108
*/
106
109
protected File dir ;
107
110
108
111
/**
109
112
* comma- or space-separated list of patterns of files that must be included ;
110
- * all files are included when omitted ; Only when not fileset(s) provided.
113
+ * all files are included when omitted ; Only when no fileset(s) provided.
111
114
*
112
115
* @parameter expression="${gfzip.includes}"
113
116
*/
114
117
protected String includes ;
115
118
116
119
/**
117
120
* comma- or space-separated list of patterns of files that must be included ;
118
- * all files are included when omitted ; Only when not fileset(s) provided.
121
+ * all files are included when omitted ; Only when no fileset(s) provided.
119
122
*
120
123
* @parameter expression="${gfzip.excludes}"
121
124
*/
@@ -137,17 +140,24 @@ public class ZipMojo extends AbstractMojo {
137
140
138
141
139
142
public void execute () throws MojoExecutionException , MojoFailureException {
140
-
143
+
141
144
this .project .addCompileSourceRoot (null );
145
+ List <ZipFileSet > fsets ;
146
+ if (filesets != null || filesets .length >0 ){
147
+ fsets = Arrays .asList (filesets );
148
+ } else {
149
+ fsets = new ArrayList <ZipFileSet >();
150
+ fsets .add (MavenUtils .createZipFileSet (dir , includes , excludes ));
151
+ }
142
152
143
153
File target = MavenUtils .createZip (
144
154
project .getProperties (),
145
155
getLog (),
146
156
duplicate ,
147
- MavenUtils . createZipFileSet ( dir , includes , excludes ) ,
157
+ fsets ,
148
158
new File (outputDirectory , finalName + '.' + extension ));
149
159
150
- if (attach . booleanValue () ) {
160
+ if (attach ) {
151
161
project .getArtifact ().setFile (target );
152
162
project .getArtifact ().setArtifactHandler (new DistributionArtifactHandler (extension , project .getPackaging ()));
153
163
}
0 commit comments