How do I fix 'Unexpected element “{}target” {antlib:org.apache.tools.ant}target' errors in my Ant build?

前端 未结 2 1731
夕颜
夕颜 2021-02-04 05:02

When I run my Ant build it fails with the following exception:

Unexpected element \"{}target\" {antlib:org.apache.tools.ant}target

I\'m using E

2条回答
  •  执笔经年
    2021-02-04 06:06

    I can reproduce this problem by putting a target outside the project element that is required in ant build files. The error indicates that there is a fault in your build file - something (a target element) in the wrong place.

    This build throws that error:

    
        
    
    
    

    Whereas this does not:

    
    
        
    
    

    In the full error message you should get a line number to guide you to the point in the file needing attention:

    #   line number here
    #         v
    build.xml:2: Unexpected element "{}target" {antlib:org.apache.tools.ant}target
    

提交回复
热议问题