Ant build on InteliiJ Community Edition no compiler errors shown

前端 未结 3 1028
你的背包
你的背包 2020-12-16 15:27

I have an existing project that I want to build in the IntelliJ Community Edition 11.1.4 running on Ubuntu 12.04.1 LTS

In the Ant Build window I added the project\'s

相关标签:
3条回答
  • 2020-12-16 15:34

    When using plain (not tree) output for ant IntelliJ uses file (line,col): error msg format for javac errors. But error view parser only understands file:line: error msg format.

    You could tweak it in PlainTextView class from antIntegration.jar http://grepcode.com/file/repository.grepcode.com/java/ext/com.jetbrains/intellij-idea/10.0/com/intellij/lang/ant/config/execution/PlainTextView.java#98

    I just changed addJavacMessage method to following and recompiled the class ``` java

     public void addJavacMessage(AntMessage message, String url) {
        final VirtualFile file = message.getFile();
        if (message.getLine() > 0) {
          final StringBuilder builder = StringBuilderSpinAllocator.alloc();
          try {
    
            if (file != null) {
              ApplicationManager.getApplication().runReadAction(new Runnable() {
                public void run() {
                  String presentableUrl = file.getPresentableUrl();
                  builder.append(presentableUrl);
    //              builder.append(' ');
                }
              });
            }
            else if (url != null) {
              builder.append(url);
    //          builder.append(' ');
            }
    //        builder.append('(');
            builder.append(':');
            builder.append(message.getLine());
            builder.append(':');
            builder.append(' ');
    //        builder.append(message.getColumn());
    //        builder.append(")");
            print(builder.toString(), ProcessOutputTypes.STDOUT);
          }
          finally {
            StringBuilderSpinAllocator.dispose(builder);
          }
        }
        print(message.getText(), ProcessOutputTypes.STDOUT);
      }
    
      public void addException(AntMessage exception, boolean showFullTrace) {
        String text = exception.getText();
        showFullTrace = false;
        if (!showFullTrace) {
          int index = text.indexOf("\r\n");
          if (index != -1) {
            text = text.substring(0, index) + "\n";
          }
        }
        print(text, ProcessOutputTypes.STDOUT);
      }
    

    ```

    And now I have clickable links in 'plain text' output mode of ant tool. Note, that 'tree mode' shows line & columns correctly - I used IDEA 13 CE.

    It would be nice if somebody to create pull request for Intellij regarding this issue.

    0 讨论(0)
  • 2020-12-16 15:35

    IDEA just prints Ant's output. Try switching the output from the tree view to the plain text view using the corresponding button on the left of the messages panel:

    Plain Text View

    If the output contains errors, you should be able to see them there.

    Also it's much faster and easier to use IDEA provided incremental compilation (Build | Make).

    0 讨论(0)
  • 2020-12-16 15:36

    Ant Correct usage in IntelliJ:

    javac includeantruntime="false" srcdir="${src.dir}" fork="yes" executable="D:/jdk1.7/bin/javac"
          destdir="${classes.dir}" includes="**/*.java" source="7" classpathref="library.classpath" ...
    

    the most important:

    executable="D:/jdk1.7/bin/javac"
    
    0 讨论(0)
提交回复
热议问题