{"action":"created","issue":{"url":"https://api.github.com/repos/srs/gradle-node-plugin/issues/115","repository_url":"https://api.github.com/repos/srs/gradle-node-plugin","labels_url":"https://api.github.com/repos/srs/gradle-node-plugin/issues/115/labels{/name}","comments_url":"https://api.github.com/repos/srs/gradle-node-plugin/issues/115/comments","events_url":"https://api.github.com/repos/srs/gradle-node-plugin/issues/115/events","html_url":"https://github.com/srs/gradle-node-plugin/issues/115","id":157320965,"number":115,"title":"Error executing NodeTask type from a subproject: \"Task with path 'nodeSetup' not found in project ':foo'\"","user":{"login":"wenslayer","id":479376,"avatar_url":"https://avatars.githubusercontent.com/u/479376?v=3","gravatar_id":"","url":"https://api.github.com/users/wenslayer","html_url":"https://github.com/wenslayer","followers_url":"https://api.github.com/users/wenslayer/followers","following_url":"https://api.github.com/users/wenslayer/following{/other_user}","gists_url":"https://api.github.com/users/wenslayer/gists{/gist_id}","starred_url":"https://api.github.com/users/wenslayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wenslayer/subscriptions","organizations_url":"https://api.github.com/users/wenslayer/orgs","repos_url":"https://api.github.com/users/wenslayer/repos","events_url":"https://api.github.com/users/wenslayer/events{/privacy}","received_events_url":"https://api.github.com/users/wenslayer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-28T05:06:47Z","updated_at":"2016-06-07T04:05:18Z","closed_at":null,"body":"# Summary\r\nConfiguring the node plugin for a multi-project build, I can run a NodeTask task out of the rootProject, but I get an error as described in the subject when I try to run it out of a subproject.\r\n\r\nAny suggestions on how to configure this properly? Any alternate approaches (other plugins?) to run the TypeScript compiler?\r\n\r\nPlease let me know if you need any further info, or would like me to try running different tests.\r\n\r\nThanks for your attention.\r\n# Repro\r\n## Files\r\n#### settings.gradle\r\n```groovy\r\ninclude 'foo', 'bar'`\r\n```\r\n#### build.gradle\r\n```groovy\r\nbuildscript { repositories { mavenCentral() } }\r\nplugins { id \"com.moowork.node\" version '0.12' }\r\nallprojects {\r\n    node {\r\n        download       = true    // download node\r\n        workDir        = new File(rootProject.projectDir, '.gradle/nodejs')\r\n        nodeModulesDir = workDir // colocate node modules with local node install\r\n    }\r\n    task installTypeScript(type: NpmTask) {\r\n        workingDir = node.workDir\r\n        args = ['install', 'typescript']\r\n    }\r\n    task runTypeScript(type: NodeTask, dependsOn: installTypeScript) {\r\n        script = new File(node.nodeModulesDir, 'node_modules/typescript/bin/tsc')\r\n        args = ['--version']\r\n    }\r\n}\r\n```\r\n\r\n## Gradle Version\r\n```\r\n$ gradle --version\r\n------------------------------------------------------------\r\nGradle 2.13\r\n------------------------------------------------------------\r\nBuild time:   2016-04-25 04:10:10 UTC\r\nBuild number: none\r\nRevision:     3b427b1481e46232107303c90be7b05079b05b1c\r\nGroovy:       2.4.4\r\nAnt:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015\r\nJVM:          1.8.0_25 (Oracle Corporation 25.25-b02)\r\nOS:           Mac OS X 10.10.5 x86_64\r\n```\r\n\r\n# Expected Results\r\nRunning the task out of the rootProject works as expected:\r\n```\r\n$ rm -fr .gradle\r\n$ gradle :runTypeScript\r\n:nodeSetup\r\nDownload https://nodejs.org/dist/v4.4.0/node-v4.4.0-darwin-x64.tar.gz\r\n:installTypeScript\r\ntypescript@1.8.10 node_modules/typescript\r\n:runTypeScript\r\nVersion 1.8.10\r\n\r\nBUILD SUCCESSFUL\r\n\r\nTotal time: 14.927 secs\r\n```\r\n**Note**: this places the node installation and node modules under the `.gradle/nodejs` directory under the root project:\r\n```\r\n$ ls -1 .gradle/nodejs/\r\nnode-v4.4.5-darwin-x64\r\nnode_modules\r\n\r\n$ ls -1 .gradle/nodejs/node_modules/\r\ntypescript\r\n```\r\n\r\n# Actual Results\r\nBut running it from the subproject does not:\r\n```\r\n$ rm -fr .gradle\r\n$ gradle :foo:runTypeScript\r\n\r\nFAILURE: Build failed with an exception.\r\n\r\n* What went wrong:\r\nCould not determine the dependencies of task ':foo:runTypeScript'.\r\n> Task with path 'nodeSetup' not found in project ':foo'.\r\n\r\n* Try:\r\nRun with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.\r\n\r\nBUILD FAILED\r\n\r\nTotal time: 3.309 secs\r\n```\r\n\r\n# Attempted Workarounds\r\n## Manually add nodeSetup task for subprojects\r\nI added the following blurb to `build.gradle`:\r\n```groovy\r\nsubprojects {\r\n    task nodeSetup(dependsOn: rootProject.nodeSetup) {}\r\n}\r\n```\r\nA different error is now encountered:\r\n```\r\n$ rm -fr .gradle\r\n$ gradle :foo:runTypeScript\r\n:nodeSetup\r\nDownload https://nodejs.org/dist/v4.4.0/node-v4.4.0-darwin-x64.tar.gz\r\n:foo:nodeSetup\r\n:foo:installTypeScript FAILED\r\n\r\nFAILURE: Build failed with an exception.\r\n\r\n* What went wrong:\r\nExecution failed for task ':foo:installTypeScript'.\r\n> Extension of type 'NodeExtension' does not exist. Currently registered extension types: [DefaultExtraPropertiesExtension]\r\n\r\n* Try:\r\nRun with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.\r\n\r\nBUILD FAILED\r\n\r\nTotal time: 12.528 secs\r\n```"},"comment":{"url":"https://api.github.com/repos/srs/gradle-node-plugin/issues/comments/224168858","html_url":"https://github.com/srs/gradle-node-plugin/issues/115#issuecomment-224168858","issue_url":"https://api.github.com/repos/srs/gradle-node-plugin/issues/115","id":224168858,"user":{"login":"wenslayer","id":479376,"avatar_url":"https://avatars.githubusercontent.com/u/479376?v=3","gravatar_id":"","url":"https://api.github.com/users/wenslayer","html_url":"https://github.com/wenslayer","followers_url":"https://api.github.com/users/wenslayer/followers","following_url":"https://api.github.com/users/wenslayer/following{/other_user}","gists_url":"https://api.github.com/users/wenslayer/gists{/gist_id}","starred_url":"https://api.github.com/users/wenslayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wenslayer/subscriptions","organizations_url":"https://api.github.com/users/wenslayer/orgs","repos_url":"https://api.github.com/users/wenslayer/repos","events_url":"https://api.github.com/users/wenslayer/events{/privacy}","received_events_url":"https://api.github.com/users/wenslayer/received_events","type":"User","site_admin":false},"created_at":"2016-06-07T04:05:18Z","updated_at":"2016-06-07T04:05:18Z","body":"Any thoughts, @srs? This is blocking me from adopting not only your plugin but others that extend it.\r\n\r\nAm I declaring it correctly for use with a multi-project build? I'd appreciate any suggestions you can offer."}}
{"actor":{"display_login":"wenslayer"}}