Ant build on InteliiJ Community Edition no compiler errors shown

前端 未结 3 1030
你的背包
你的背包 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.

提交回复
热议问题