@@ -167,7 +167,7 @@ export function checkParentPom(xmlString: String) {
167167 var parentPom = false ;
168168 parseString ( xmlString , function ( err : any , result : any ) {
169169
170- // check for liberty maven plugin in plugin management
170+ // check for liberty maven plugin or boost maven plugin in plugin management
171171 if ( result . project . build !== undefined ) {
172172 for ( var i = 0 ; i < result . project . build . length ; i ++ ) {
173173 var pluginManagement = result . project . build [ i ] . pluginManagement ;
@@ -201,6 +201,31 @@ export function checkParentPom(xmlString: String) {
201201 return parentPom ;
202202}
203203
204+ export function checkBuild ( build : { plugins : { plugin : any ; } [ ] ; } [ ] | undefined ) {
205+ if ( build !== undefined ) {
206+ for ( var i = 0 ; i < build . length ; i ++ ) {
207+ var plugins = build [ i ] . plugins ;
208+ if ( plugins !== undefined ) {
209+ for ( var j = 0 ; j < plugins . length ; j ++ ) {
210+ var plugin = build [ i ] . plugins [ j ] . plugin ;
211+ if ( plugin !== undefined ) {
212+ for ( var k = 0 ; k < plugin . length ; k ++ ) {
213+ if ( plugin [ k ] . artifactId [ 0 ] === "liberty-maven-plugin" && plugin [ k ] . groupId [ 0 ] === "io.openliberty.tools" ) {
214+ console . debug ( "Found liberty-maven-plugin in the pom.xml" ) ;
215+ return true ;
216+ }
217+ if ( plugin [ k ] . artifactId [ 0 ] === "boost-maven-plugin" && plugin [ k ] . groupId [ 0 ] === "org.microshed.boost" ) {
218+ console . debug ( "Found boost-maven-plugin in the pom.xml" ) ;
219+ return true ;
220+ }
221+ }
222+ }
223+ }
224+ }
225+ }
226+ }
227+ }
228+
204229export function checkPom ( xmlString : String , childrenMap : Map < string , String [ ] > ) {
205230 var parseString = require ( 'xml2js' ) . parseString ;
206231 var validPom = false ;
@@ -221,32 +246,27 @@ export function checkPom(xmlString: String, childrenMap: Map<string, String[]>)
221246 }
222247 }
223248
224- // check for liberty maven plugin
225- if ( result . project . build !== undefined ) {
226- for ( var i = 0 ; i < result . project . build . length ; i ++ ) {
227- var plugins = result . project . build [ i ] . plugins ;
228- if ( plugins !== undefined ) {
229- for ( var j = 0 ; j < plugins . length ; j ++ ) {
230- var plugin = result . project . build [ i ] . plugins [ j ] . plugin ;
231- if ( plugin !== undefined ) {
232- for ( var k = 0 ; k < plugin . length ; k ++ ) {
233- if ( plugin [ k ] . artifactId [ 0 ] === "liberty-maven-plugin" && plugin [ k ] . groupId [ 0 ] === "io.openliberty.tools" ) {
234- console . debug ( "Found liberty-maven-plugin in the pom.xml" ) ;
235- validPom = true ;
236- return ;
237- }
238- if ( plugin [ k ] . artifactId [ 0 ] === "boost-maven-plugin" && plugin [ k ] . groupId [ 0 ] === "org.microshed.boost" ) {
239- console . debug ( "Found boost-maven-plugin in the pom.xml" ) ;
240- validPom = true ;
241- return ;
242- }
243- }
249+ // check for liberty maven plugin in profiles
250+ if ( result . project . profiles !== undefined ) {
251+ for ( var i = 0 ; i < result . project . profiles . length ; i ++ ) {
252+ var profile = result . project . profiles [ i ] . profile ;
253+ if ( profile !== undefined ) {
254+ for ( var j = 0 ; j < profile . length ; j ++ ) {
255+ if ( checkBuild ( profile [ j ] . build ) ) {
256+ validPom = true ;
257+ return ;
244258 }
245259 }
246260 }
247261 }
248262 }
249263
264+ // check for liberty maven plugin in plugins
265+ if ( checkBuild ( result . project . build ) ) {
266+ validPom = true ;
267+ return ;
268+ }
269+
250270 if ( err ) {
251271 console . error ( "Error parsing the pom " + err ) ;
252272 return ;
0 commit comments