kelemen / netbeans-gradle-project

This project is a NetBeans plugin able to open Gradle based Java projects. The implementation is based on Geertjan Wielenga's plugin.
170 stars 57 forks source link

Suport console link to error file:line when source is in custom location #338

Open entonio opened 7 years ago

entonio commented 7 years ago

I apologise beforehand if this isn't within the scope of the plugin. I really don't know.

I have a project with multiple source folders. It mostly works fine and I'm trying to iron out the remaining issues.

/Users/whatever/SomeProject/core/build.gradle:

sourceSets {
    main {
        java {
            srcDirs 'src/main/java'
            srcDirs '../module1/impl2/src/main/java'
        }
    }
}

Output:

Executing: gradle build
Arguments: [-x, test, -c, /Users/whatever/SomeProject/core/settings.gradle]

/Users/whatever/SomeProject/core/src/main/java/com/wb/Text.java:69: error: not a statement
        a;
        ^
/Users/whatever/SomeProject/module1/impl2/src/main/java/com/wb/mod1/imp/Scoop.java:45: error: not a statement
        a;
        ^
2 errors
:compileJava FAILED

Thanks for your attention.

kelemen commented 7 years ago

Only the actual project directory is considered and not an arbitrary path. I have updated the code to actually consider all subprojects of the same multi-project build. I think that should be enough for you. However, I'm not sure how I would consider an arbitrary path because I don't want to check every substring on the output if it is an existing file or not.

You might try building the plugin from the sources and see if it works for you.

entonio commented 7 years ago

I understand your concern, but wouldn't it be possible to check only lines of the format

// regexp
(.+[/\\]+.+):\d+:\s+(?:error|warning):\s[\w]+.*
// same regexp as Java string - http://www.regexplanet.com/advanced/java/index.html
"(.+[/\\\\]+.+):\\d+:\\s+(?:error\|warning):\\s[\\w]+.*"

?

kelemen commented 7 years ago

That sounds reasonable, though I want to spend time on helping some of the dependants of this plugins due to my incompatible API changes for NB 9.

Though, if you create pull request, I would gladly merge it. For this, you should create an implementation of OutputLinkFinder (StackTraceConsumer and SubPathConsumer are examples of that) and add an instance of the new OutputLinkFinder in AsyncGradleTask to the stdout and stderr processors.