@@ -65,7 +65,7 @@ func Build(opts BuildOptions) error {
6565
6666 // Step 2: Resolve MxBuild
6767 fmt .Fprintln (w , "Resolving MxBuild..." )
68- mxbuildPath , err := resolveMxBuild (opts .MxBuildPath )
68+ mxbuildPath , err := resolveMxBuild (opts .MxBuildPath , pv . ProductVersion )
6969 if err != nil {
7070 // Auto-download fallback
7171 fmt .Fprintln (w , " MxBuild not found locally, downloading from CDN..." )
@@ -96,7 +96,7 @@ func Build(opts BuildOptions) error {
9696 // Step 4: Pre-build check
9797 if ! opts .SkipCheck {
9898 fmt .Fprintln (w , "Checking project for errors..." )
99- mxPath , err := ResolveMx (opts .MxBuildPath )
99+ mxPath , err := ResolveMxForVersion (opts .MxBuildPath , pv . ProductVersion )
100100 if err != nil {
101101 fmt .Fprintf (w , " Skipping check: %v\n " , err )
102102 } else {
@@ -383,8 +383,10 @@ func Run(opts RunOptions) error {
383383}
384384
385385// findPADDir searches for a PAD output in the output directory tree.
386- // It looks for a Dockerfile first, then for docker_compose/Default.yaml as a fallback
387- // (MxBuild 11.6.3+ generates docker_compose instead of a Dockerfile).
386+ // It recognizes:
387+ // - classic PAD output with a Dockerfile
388+ // - PAD output with docker_compose/Default.yaml
389+ // - newer PAD output already extracted at the build root (app/bin/etc/lib)
388390func findPADDir (outputDir string ) (string , error ) {
389391 // Check output dir itself
390392 if isPADDir (outputDir ) {
@@ -405,19 +407,48 @@ func findPADDir(outputDir string) (string, error) {
405407 }
406408 }
407409
408- return "" , fmt .Errorf ("no PAD output found in %s (looked for Dockerfile or docker_compose/Default.yaml)" , outputDir )
410+ return "" , fmt .Errorf ("no PAD output found in %s (looked for Dockerfile, docker_compose/Default.yaml, or extracted app/bin/etc/lib layout )" , outputDir )
409411}
410412
411413// isPADDir checks if a directory contains PAD output.
412- // Recognizes both Dockerfile-based PAD and docker_compose-based PAD.
414+ // Recognizes Dockerfile-based PAD, docker_compose-based PAD, and newer
415+ // already-extracted PAD layout at the build root.
413416func isPADDir (dir string ) bool {
414417 if _ , err := os .Stat (filepath .Join (dir , "Dockerfile" )); err == nil {
415418 return true
416419 }
417420 if _ , err := os .Stat (filepath .Join (dir , "docker_compose" , "Default.yaml" )); err == nil {
418421 return true
419422 }
420- return false
423+ return hasExtractedPADLayout (dir )
424+ }
425+
426+ func hasExtractedPADLayout (dir string ) bool {
427+ requiredDirs := []string {
428+ filepath .Join (dir , "app" ),
429+ filepath .Join (dir , "bin" ),
430+ filepath .Join (dir , "etc" ),
431+ filepath .Join (dir , "lib" ),
432+ }
433+ for _ , path := range requiredDirs {
434+ info , err := os .Stat (path )
435+ if err != nil || ! info .IsDir () {
436+ return false
437+ }
438+ }
439+
440+ requiredFiles := []string {
441+ filepath .Join (dir , "bin" , "start" ),
442+ filepath .Join (dir , "lib" , "runtime" , "launcher" , "runtimelauncher.jar" ),
443+ }
444+ for _ , path := range requiredFiles {
445+ info , err := os .Stat (path )
446+ if err != nil || info .IsDir () {
447+ return false
448+ }
449+ }
450+
451+ return true
421452}
422453
423454// flattenPADDir moves contents from a PAD subdirectory to the output root directory.
0 commit comments