File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
src/main/kotlin/com/cognifide/gradle/aem/common/mvn Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -101,7 +101,7 @@ class ModuleResolver(val build: MvnBuild) {
101101
102102 fun isPackage (pom : File ) = pom.parentFile.resolve(build.contentPath.get()).exists() || pom.readText().let { text ->
103103 text.contains(" <packaging>content-package</packaging>" ) || packagePlugins.get().any {
104- text.substringBetweenTag(" build" ).substringBetweenTag(" plugins" ).contains(" <artifactId>$it </artifactId>" )
104+ text.substringBetweenTag(" build" ).ignoreTag( " pluginManagement " ). substringBetweenTag(" plugins" ).contains(" <artifactId>$it </artifactId>" )
105105 }
106106 }
107107
@@ -115,4 +115,17 @@ class ModuleResolver(val build: MvnBuild) {
115115 private fun String.containsTag (tag : String ) = this .contains(" <$tag >" ) && this .contains(" </$tag >" )
116116
117117 private fun String.substringBetweenTag (tag : String ) = this .substringAfter(" <$tag >" ).substringBefore(" </$tag >" )
118+
119+ private fun String.ignoreTag (tag : String ): String {
120+ val startTag = " <$tag >"
121+ val endTag = " </$tag >"
122+
123+ val startIndex = indexOf(startTag)
124+ val endIndex = indexOf(endTag, startIndex + startTag.length)
125+
126+ if (startIndex != - 1 && endIndex != - 1 )
127+ return substring(0 , startIndex) + substring(endIndex + endTag.length)
128+
129+ return this
130+ }
118131}
You can’t perform that action at this time.
0 commit comments