This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 206199 - Grails project doesn't resolve compile time dependencies specified in BuildConfig
Summary: Grails project doesn't resolve compile time dependencies specified in BuildCo...
Status: RESOLVED FIXED
Alias: None
Product: groovy
Classification: Unclassified
Component: Grails (show other bugs)
Version: 7.1
Hardware: All Linux
: P3 normal with 1 vote (vote)
Assignee: Martin Janicek
URL: http://grails.org/doc/1.3.7/guide/3.%...
Keywords:
: 184895 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-12-09 16:19 UTC by akochnev
Modified: 2013-05-02 09:31 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
patch to resolve compile dependencies (3.48 KB, patch)
2011-12-09 16:23 UTC, akochnev
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description akochnev 2011-12-09 16:19:46 UTC
The project only accounts for dependencies in plugins, and the project's local lib directory; however, if a dependency is specified using the BuildConfig's dependency style (see example below), the jar is not added to the compile classpath

Sample dependency statement from BuildConfig.groovy
dependencies {

        compile('org.apache.solr:solr-solrj:3.1.0')      {
            excludes 'xalan', 'xml-apis', 'slf4j-jdk14'
        }
}

Product Version = NetBeans IDE Dev (Build 20111208-9a6d846d5dc2)
Operating System = Linux version 3.0.0-13-generic running on amd64
Java; VM; Vendor = 1.6.0_26
Runtime = Java HotSpot(TM) 64-Bit Server VM 20.1-b02
Comment 1 akochnev 2011-12-09 16:23:49 UTC
Created attachment 114007 [details]
patch to resolve compile dependencies
Comment 2 Martin Janicek 2011-12-15 09:59:09 UTC
Thanks a lot! This seems reasonable. I'm going to test the patch and will integrate after.
Comment 3 Martin Janicek 2011-12-29 19:03:50 UTC
Alex, I've seen that in your patch you are calling BuildConfig.getCompileDependencies(). Because you were testing Groovy parser with this patch integrated you probably have also some concrete implementation of this method, right? Could you attached it as well?

Thanks in advance. M.
Comment 4 akochnev 2011-12-29 19:53:38 UTC
Martin - I'm not sure how I missed it, below is the implementation of BuildConfig.getCompileDependencies


public synchronized List<File> getCompileDependencies() {
        List<File> deps = new ArrayList<File>();
        assert Thread.holdsLock(this);
        try {
            if (buildSettingsInstance != null) {
                Method getCompileDependenciesMethod = buildSettingsInstance.getClass().getMethod("getCompileDependencies", // NOI18N
                        new Class[] {});
                List<File> depsList = (List<File>)getCompileDependenciesMethod.invoke(buildSettingsInstance, new Object[] {});
                deps.addAll(depsList);
            }
        } catch (NoSuchMethodException ex) {
            LOGGER.log(Level.FINE, null, ex);
        } catch (IllegalAccessException ex) {
            LOGGER.log(Level.FINE, null, ex);
        } catch (InvocationTargetException ex) {
            LOGGER.log(Level.FINE, null, ex);
        }
        return deps;
    }
Comment 5 Martin Janicek 2011-12-30 12:24:59 UTC
I've integrated patch (to groovy_parser branch for now): web-main #235b88d3d85d
Comment 6 akochnev 2012-04-20 18:18:34 UTC
Changeset #4aebb18f9a63 reverted the fix that made the project take into consideration dependencies specified in BuildConfig. One of the concerns w/ adding the dependencies was the indexing implications; however, now that Issue #180230 is resolved, this really should go back in.
Comment 7 Martin Janicek 2012-04-26 14:05:13 UTC
Actually the fix has never been in trunk (I've push the change sets into the groovy_parser branch which were dropped out at the end).
I'm going to make the changes in trunk as well.
Comment 8 Martin Janicek 2012-05-17 06:49:42 UTC
*** Bug 184895 has been marked as a duplicate of this bug. ***
Comment 9 athompson 2012-05-17 15:24:57 UTC
Also please don't forget inline plugins, such as:  grails.plugin.location.'core-plugin'="../CorePlugin"
Comment 10 athompson 2012-08-06 18:58:48 UTC
This does not appear to have made into the trunk.
Comment 11 Martin Janicek 2012-11-22 15:42:26 UTC
Fixed in: web-main #64d25569108c
Comment 12 Quality Engineering 2012-11-25 03:10:26 UTC
Integrated into 'main-golden', will be available in build *201211250002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/64d25569108c
User: Martin Janicek <mjanicek@netbeans.org>
Log: #206199 - Grails project doesnt resolve compile time dependencies specified in BuildConfig
Comment 13 juanflynn 2013-03-05 18:00:00 UTC
This issue seems to be happening for in 7.3 (Build 201302132200) / Groovy plugin ver. 1.25.1.

Are there any workarounds I can put in place so that a plugin's libraries are picked up? The plugins are listed in BuildConfig.groovy in the plugins { } section.
Comment 14 calvin 2013-05-02 09:14:38 UTC
Not working in 7.3 for me either.
Comment 15 calvin 2013-05-02 09:22:07 UTC
Seems to work in the current development build though, 201304292301
Comment 16 calvin 2013-05-02 09:31:49 UTC
Sorry, i am taking the last comment back, does not work there either.