Compile failed; see the compiler error output for details

前端 未结 5 1595
梦谈多话
梦谈多话 2020-12-10 12:25

When I tried to compile build.xml file, below error is hitting:

BUILD FAILED

C:\\Users\\workspace\\testrepo\\src\\build.xml:36: Comp         


        
相关标签:
5条回答
  • 2020-12-10 12:31

    To see compiled error in log use below given command:

    d:\yourdirectory of checkout>ant clean deploy>log.txt
    

    It will create a complete log in your check out directory. So now you can check actual errors there.

    0 讨论(0)
  • 2020-12-10 12:33

    In my case, there was an unused import statement in a class whose package cannot be found elsewhere but was copied over because I copied the class from another project of mine. Be it was listed in the error log as "package not found" even if the error log itself wasn't clear-cut. I had to search through all the warnings the log generated in my case.

    0 讨论(0)
  • 2020-12-10 12:47

    The following solution worked out good for me:

    1) Define the following class:

    package somepackage;
    
    import org.apache.tools.ant.taskdefs.Javac;
    import org.apache.tools.ant.types.Commandline;
    import org.eclipse.jdt.core.JDTCompilerAdapter;
    
    public class JDTCompiler15 extends JDTCompilerAdapter {
        @Override
        public void setJavac(Javac attributes) {
            if (attributes.getTarget() == null) {
                    attributes.setTarget("1.6");
            }
            if (attributes.getSource() == null) {
                    attributes.setSource("1.6");
            }
    
            super.setJavac(attributes);
        }
            // THIS METHOD IS RESPONSIBLE FOR PRINGTING THE ERRORS/WARNING.
        @Override
        protected void logAndAddFilesToCompile(Commandline cmd) {
            super.logAndAddFilesToCompile(cmd);
            System.err.println(cmd.toString());
        }
    
    }
    

    2) Add the following VM parameter: -Dbuild.compiler=somepackage.JDTCompiler15

    0 讨论(0)
  • 2020-12-10 12:47

    If you are using Weblogic to generate the client, you must add the "weblogic.jar" from the installation directory into the Additional Classpath, so Ant will know where the Ant.tools.... exist.

    I got the same issue and I am trying to solve this problem not adding it as additional classpath since I copy all jars into my project, but still getting this error.

    0 讨论(0)
  • 2020-12-10 12:49

    There is a compile error that occurred earlier during the build. Look for that error in the same output log file and try to fix it.

    0 讨论(0)
提交回复
热议问题