subant failonerror subtleties

前端 未结 2 1287
梦毁少年i
梦毁少年i 2021-01-19 07:57

I have ant code that kicks off a release build in all subdirectories:


    

        
2条回答
  •  自闭症患者
    2021-01-19 08:30

    Suggest you look at the extensions available in the ant-contrib tasks.

    The 'for' task can probably be adapted to meet your requirements.

    Your 'all-release' target, with the ant-contrib taskdef might look like this:

    
        
            
        
    
    
    
        
            
                
            
            
                
            
        
    
    

    Using some other ant-contrib features it may be possible to get the list of fails.

    Sample log from above build.xml:

    $ ant all-release
    Buildfile: build.xml
    
    all-release:
         [echo] /work/Scratch/dir1/build.xml
    
    sub-release:
         [echo] dir1
         [echo] /work/Scratch/dir2/build.xml
    
    sub-release:
         [echo] dir2
          [for] /work/Scratch/dir2/build.xml: The following error occurred while executing this line:
          [for] /work/Scratch/build.xml:17: The following error occurred while executing this line:
          [for] /work/Scratch/dir2/build.xml:6: dir2 failed
         [echo] /work/Scratch/dir3/build.xml
    
    sub-release:
         [echo] dir3
    
    BUILD FAILED
    /work/Scratch/build.xml:11: Keepgoing execution: 1 of 3 iterations failed.
    
    Total time: 0 seconds
    

提交回复
热议问题