Good morning,
I am working on a legacy Ear project with this structure.
| ── app
│ ├── build.gradle
│ └── src
│ └── CommonsUtil.java
│ └── GuavaUtil.java
│ └── Main.java
│ └── Util.java
| - uicomponent
| - security.war
| - app.war
| - reportresources.jar
| - build.gradle
uicomponent - build.gradle
subprojects {
apply plugin: 'war'
//apply plugin: 'java-library'
repositories {
mavenCentral()
}
group = 'gov'
version = '1.0-SNAPSHOT'
// Common dependencies, e.g., shared libraries
dependencies {
compileOnly("javax.servlet:javax.servlet-api:4.0.1")
compileOnly("javax.servlet.jsp:javax.servlet.jsp-api:2.3.3")
implementation("jsptags:pager-taglib:2.0")
implementation("org.apache.struts:struts-core:1.3.10")
implementation("org.apache.struts:struts-extras:1.3.10")
implementation("org.apache.struts:struts-taglib:1.3.10")
implementation("org.apache.struts:struts-tiles:1.3.10")
}
war {
exclude {"$projectDir/reportresources"}
webAppDirectory = file('WebContent')
// classpath = classpath.filter { item ->
// // Replace 'your-other-project-name' with the actual archive name of the project
// !item.name.contains('reportresources')
// }
// classpath = classpath.filter { file ->
// println file.name
// (
// !file.name.startsWith('reportresources')
// )
// }
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
// Optional: If web.xml is also in a non-standard location
// webXml = file('WebContent/WEB-INF/web.xml')
}
// jar {
// from("$projectDir/") {
// include '**/*' // Includes all XML files from the main source set's output directory
// }
// }
war.dependsOn(':app:jar')
}
Error:
problem was found with the configuration of task ':app:uicomponent:reportresources:war' (type 'War').
- Gradle detected a problem with the following location: 'C:\Projects\JUV\DevAzure\app\uicomponent\reportresources\build\libs\reportresources-1.0-SNAPSHOT.war'.
Reason: Task ':app:uicomponent:reportresources:jar' uses this output of task ':app:uicomponent:reportresources:war' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.
Possible solutions:
1. Declare task ':app:uicomponent:reportresources:war' as an input of ':app:uicomponent:reportresources:jar'.
2. Declare an explicit dependency on ':app:uicomponent:reportresources:war' from ':app:uicomponent:reportresources:jar' using Task#dependsOn.
3. Declare an explicit dependency on ':app:uicomponent:reportresources:war' from ':app:uicomponent:reportresources:jar' using Task#mustRunAfter.
Thanks,
Richard