@@ -18,7 +18,7 @@ component accessors=true {
18
18
property name = ' projectRoot' type = " string" ;
19
19
/* folder inside root project where source files reside (.java) */
20
20
property name = ' sourceDirectory' type = ' string' ;
21
- property name = ' classPathDirectory ' type = ' string ' ;
21
+ property name = ' classPaths ' type = ' array ' ;
22
22
property name = ' classOutputDirectory' type = ' string' ;
23
23
property name = ' verbose' type = ' boolean' ;
24
24
property name = ' encode' type = ' string' ;
@@ -33,6 +33,9 @@ component accessors=true {
33
33
property name = ' customManifestParams' type = ' struct' ;
34
34
property name = ' resourcePath' type = ' string' ;
35
35
property name = ' classTextFilePaths' type = ' array' ;
36
+ property name = ' fatJarPaths' type = ' array' ;
37
+ property name = ' javaDocDestinationDir' type = ' string' ;
38
+ property name = ' useJavaDoc' type = ' boolean' ;
36
39
37
40
// DI
38
41
property name = " packageService" inject = " PackageService" ;
@@ -63,6 +66,8 @@ component accessors=true {
63
66
setCustomManifestParams ( {} );
64
67
setResourcePath ( ' src\main\resources\' );
65
68
setClassTextFilePaths ([' ' ]);
69
+ setJavaDocDestinationDir (' javaDocs\main' )
70
+ setUseJavaDoc (false );
66
71
return this ;
67
72
}
68
73
@@ -123,12 +128,6 @@ component accessors=true {
123
128
return this ;
124
129
}
125
130
126
- // no longer needed
127
- /* function addToManifest( required string customManifest ) {
128
- setCustomManifest( fileSystemutil.resolvePath( customManifest, getProjectRoot() ) );
129
- return this;
130
- } */
131
-
132
131
function manifest ( required struct customParams ) {
133
132
setCustomManifestParams ( customParams );
134
133
return this ;
@@ -138,15 +137,33 @@ component accessors=true {
138
137
// if it has a resourcefolder it uses that one
139
138
// if its empty then use src\main\resources
140
139
setResourcePath ( fileSystemutil .resolvePath ( resourcesPath , getProjectRoot () ) )
140
+ return this ;
141
+ }
142
+
143
+ function withJavaDocs (){
144
+ return this ;
141
145
}
142
146
143
- function toFatJar ( ) {
144
- // if it has a jarFolder use that one
145
- // if it does not have any use java\main\libs
147
+ function withClassPath ( required any classPath ) {
148
+ if ( isSimpleValue ( arguments .classPath ) ) {
149
+ arguments .classPath = listToArray ( arguments .classPath , " ," , true );
150
+ }
151
+ arguments .classPath = arguments .classPath .reduce ( function ( classPaths ,cp ) {
152
+ return classPaths .append (directorylist ( fileSystemutil .resolvePath ( cp , getProjectRoot () ), true , ' array' , ' *jar' ), true );
153
+ }, [] );
154
+ setClassPaths ( arguments .classPath );
155
+ return this ;
156
+ }
146
157
147
- // take all the jars in libs folder and unzip them
148
- // add them to the classoutputdirectory with the rest of then
149
- // make the jar
158
+ function toFatJar ( string jarName = ' ' , any includeJars = [] ) {
159
+ if ( isSimpleValue ( arguments .fatJarPathList ) ) {
160
+ arguments .fatJarPathList = listToArray ( arguments .fatJarPathList , " ," , true );
161
+ }
162
+ arguments .fatJarPathList = arguments .fatJarPathList .map ( function ( s ) {
163
+ return fileSystemutil .resolvePath ( arguments .s , getProjectRoot () );
164
+ } );
165
+ variables .fatJarPaths = arguments .fatJarPathList ;
166
+ return this ;
150
167
}
151
168
152
169
function run () {
@@ -164,9 +181,18 @@ component accessors=true {
164
181
job .start ( ' update manifest file' );
165
182
updateManifestFile ();
166
183
job .complete ();
167
- job .start ( ' creating the jar' );
168
- buildJar ();
169
- job .complete ();
184
+
185
+ job .start ( ' creating the normal jar' );
186
+ buildJar ();
187
+ job .complete ();
188
+
189
+ job .addLog ( " len :-> " & len ( getFatJarPaths () ) );
190
+ if ( len ( getFatJarPaths () ) ) {
191
+ job .start ( ' creating the fat jar' );
192
+ // buildFatJar();
193
+ job .complete ();
194
+ }
195
+
170
196
job .start ( ' move resources to jar' );
171
197
moveResources ();
172
198
job .complete ();
@@ -183,11 +209,14 @@ component accessors=true {
183
209
184
210
// shell.printString( " glob-> start... " );
185
211
// job.addLog( " glob-> start... " );
212
+ var currentProjectRoot = getProjectRoot ();
186
213
187
214
var globber = wirebox .getInstance ( ' globber' );
188
215
var tempSrcFileName = tempDir & ' temp#createUUID () #.txt' ;
216
+ /* var tempSrcFileName = currentProjectRoot & 'temp#createUUID()#.txt'; */
189
217
// job.addLog( " " & serialize( getSourcePaths() ) & " " );
190
218
219
+ // use only one variable
191
220
if ( len ( getSourcePaths () ) EQ 1 and getSourcePaths ()[1 ] == " " ) {
192
221
setSourcePaths ( [getSourceDirectory ()] );
193
222
}
@@ -215,8 +244,13 @@ component accessors=true {
215
244
216
245
writeTempSourceFile ( tempSrcFileName );
217
246
247
+ var classPathString = " " ;
248
+ if ( len (getClassPaths ()) ) {
249
+ classPathString = ' -cp "#getClassPaths ().toList (' ;' ) #"' ;
250
+ }
251
+
218
252
// var javacCommand = 'run ""#getJavaBinFolder()#javac" "@#tempSrcFileName#" -d "#variables.classOutputDirectory#" #variables.compileOptionsString#"';
219
- var javacCommand = ' run ""#getJavaBinFolder () #javac" "@#tempSrcFileName #" -d "#variables .classOutputDirectory #""' ;
253
+ var javacCommand = ' run ""#getJavaBinFolder () #javac" # classPathString # "@#tempSrcFileName #" -d "#variables .classOutputDirectory #""' ;
220
254
// var javacCommand = 'run ""foo why" "bar" -d "test""';
221
255
222
256
/* if ( getVerbose() ) {
@@ -287,7 +321,9 @@ component accessors=true {
287
321
.reduce (( acc , row ) = > {
288
322
row .directory = replaceNoCase ( row .directory , projectRoot , " " );
289
323
row .directory = replaceNoCase ( row .directory , classOutput , " " );
290
- wipPath = fileSystemutil .normalizeSlashes ( row .directory & " /" & row .name );
324
+ filePath = row .directory & " \" & row .name ;
325
+ filePath = replaceNoCase ( filePath , classOutput , " " );
326
+ wipPath = fileSystemutil .normalizeSlashes ( filePath );
291
327
wipPath = " -C " & classOutput & " " & wipPath ;
292
328
finalPath = fileSystemutil .normalizeSlashes ( wipPath );
293
329
return listappend ( acc , finalPath , chr (10 ) );
@@ -314,8 +350,8 @@ component accessors=true {
314
350
var jarName = getJarNameString ();
315
351
var currentProjectRoot = getProjectRoot ();
316
352
317
- var tempClassFileName = tempDir & ' temp#createUUID () #.txt' ;
318
- /* var tempClassFileName = currentProjectRoot & 'temp#createUUID()#.txt'; */
353
+ /* var tempClassFileName = tempDir & 'temp#createUUID()#.txt'; */
354
+ var tempClassFileName = currentProjectRoot & ' temp#createUUID () #.txt' ;
319
355
320
356
var sourceFolders = [];
321
357
buildJarSourceFolders = fileSystemutil .resolvePath ( variables .classOutputDirectory , getProjectRoot () );
@@ -357,7 +393,9 @@ component accessors=true {
357
393
// writeTempSourceFile( tempSrcFileName,['D:\Javatest\greetings\classes\**.class'], ".class" );
358
394
writeTempClassFiles ( tempClassFileName , sourceFolders , " .class" );
359
395
360
- var jarClassString = createClassStringFromClassTextFiles ()
396
+ var jarClassString = createClassStringFromClassTextFiles ();
397
+
398
+
361
399
362
400
if ( ! directoryExists ( currentLibsDir ) ) {
363
401
directoryCreate ( currentLibsDir );
@@ -375,9 +413,9 @@ component accessors=true {
375
413
command ( j ).run ();
376
414
377
415
} finally {
378
- if ( FileExists ( tempClassFileName ) ) {
416
+ /* if ( FileExists( tempClassFileName ) ) {
379
417
fileDelete( tempClassFileName );
380
- }
418
+ } */
381
419
}
382
420
383
421
@@ -596,7 +634,7 @@ component accessors=true {
596
634
return jarName ;
597
635
}
598
636
599
- function combiningFatJar () {
637
+ function buildFatJar () {
600
638
j = " run fat jar " ;
601
639
shell .printString ( " " & j & " " );
602
640
// command( j ).run();
0 commit comments