-
-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Project Dependency Configuration #71
Comments
Where I work we use |
So this plugin provides an easy way to work with npm/yarn/etc, it doesn't build things itself like the java plugin does. |
I was able to use gradle configurations to set up the proper dependencies to work around this. It works like this:
configurations {
npmResources {
canBeResolved = true
canBeConsumed = true
}
dependencies {
npmResources fileTree("${libBuildDir}/") {
builtBy 'buildLib'
}
}
dependencies {
npmResources project(path: ':projects:my-library', configuration: 'npmResources')
}
npmInstall.dependsOn(configurations.npmResources) |
Personnally, I use a different approach to do that. I make a jar including the webapp in its resources and I add an Your suggestion seems to be more elegant than mine, but there is something I don't understand (I don't know very well how the Gradle configurations work). Is the |
I don't think any plugin defines npmResources. You can declare configurations on the fly, which is what I'm doing. Adding the dependency in the way I did it lets the downstream project depend on it and include it. In my WAR task I was able to do something like this to get the Node output into my WAR where Spring Boot could find it:
Please note that I actually used a different configuration that depended on the output of npm_run_build since npmResources was used for my library project, but it works the same. |
Ok, thank you! Now I understand how you proceed and that's very elegant! I read again your original question and as far as I understand, your problem with this configuration is that when you build the main Spring Boot application, it does not automatically trigger a build of the web project? |
I'm trying to set up a multi-project Gradle build. We have a node (Angular) library, several Angular projects that depend on the library, and Spring Boot (Java) projects that will contain the final output. There are examples on the web for how to set up the node vs Java projects so that the node projects build first and their output is included in the WAR produced by the Java projects so that was pretty simple.
However, because the node plugin doesn't appear to declare any outputs or configurations, I am having problems getting node projects to depend on each other or the library. The Java plugin declares dependency configurations like readOnly, implementation, etc. If this plugin declares anything like that, I cannot figure out what it is.
Is there a way to make one node project depend on another node project?
The text was updated successfully, but these errors were encountered: