Run ant task in different jvm

前端 未结 3 1664
北恋
北恋 2020-12-15 12:23

Our ant build is run using Java 1.7.0 for JAVA_HOME. This way javac and all other Java dependent targets use the correct Java by default.

But 1 ant target from an ex

3条回答
  •  既然无缘
    2020-12-15 13:00

    To make Jeanne Boyarsky's suggestion of using the exec Ant task concrete, the following example wraps the exec task in a macro to simplify calling targets with various JVMs. Notice that the JVM is set using the Ant environment variable JAVACMD.

    Example Project

    
    
    
      
        
        
        
        
          
            
            
            
          
        
      
    
    
      
        
      
    
    
      
        
    
        
        
      
    
    

    Output

    test:
         [exec] Buildfile: /home/your/project/build.xml
         [exec] 
         [exec] echo-java-version:
         [exec]      [echo] Java version: 1.7.0
         [exec] 
         [exec] BUILD SUCCESSFUL
         [exec] Total time: 0 seconds
         [exec] Buildfile: /home/your/project/build.xml
         [exec] 
         [exec] echo-java-version:
         [exec]      [echo] Java version: 1.6.0
         [exec] 
         [exec] BUILD SUCCESSFUL
         [exec] Total time: 0 seconds
    
    BUILD SUCCESSFUL
    Total time: 2 seconds
    

提交回复
热议问题