Skip to content

Commit 0204c4e

Browse files
committed
artifactory-maven-plugin: POM is created in "build" directory
1 parent b693903 commit 0204c4e

File tree

2 files changed

+9
-16
lines changed

2 files changed

+9
-16
lines changed

Diff for: .gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
/build-info-extractor-gradle/src/examples/publishTestProject/build
1111
/build-info-extractor-gradle/src/examples/publishTestProject/*/build
1212
/build-info-extractor-gradle/src/examples/publishTestProject/*/*/build
13-
build-info-extractor-maven3-plugin/pom.xml
1413
build-info.ipr
1514
build-info.iws
1615
atlassian-*.xml

Diff for: build.gradle

+9-15
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ subprojects {
125125
from sourceSets.main.allSource
126126
classifier = 'sources'
127127
}
128-
128+
129129
task javadocJar(type: Jar, dependsOn: javadoc) {
130130
classifier = 'javadoc'
131131
from javadoc.destinationDir
@@ -401,25 +401,19 @@ project('artifactory-maven-plugin') {
401401
task pluginDescriptor( type: Exec ) {
402402
// http://www.gradle.org/docs/current/dsl/org.gradle.api.tasks.Exec.html
403403

404-
final mvn = project.hasProperty( 'mvn' ) ? project.mvn : System.getProperty( 'os.name' )?.toLowerCase()?.contains( 'win' ) ? 'mvn.bat' : 'mvn'
405-
final mvnArgs = project.hasProperty( 'mvnArgs' ) ? project.mvnArgs : ''
406-
final allArgs = [ '-e', '-B', mvnArgs, 'org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor' ].grep()
404+
final mvn = project.hasProperty( 'mvn' ) ? project.mvn : System.getProperty( 'os.name' )?.toLowerCase()?.contains( 'win' ) ? 'mvn.bat' : 'mvn'
405+
final mvnArgs = project.hasProperty( 'mvnArgs' ) ? project.mvnArgs : ''
406+
final File pom = project.file( "$buildDir/pom.xml" )
407+
final allArgs = [ '-e', '-B', '-f', pom.canonicalPath, mvnArgs, 'org.apache.maven.plugins:maven-plugin-plugin:3.2:descriptor' ].grep()
407408

408409
executable mvn
409410
args allArgs
410411

411412
doFirst {
412413
assert project.compileGroovy.destinationDir.directory
413-
final File pom = project.file( 'pom.xml' )
414414
install.repositories.mavenInstaller.pom.writeTo( pom )
415-
assert pom.file, "[$pom.canonicalPath] was not created"
416-
println "POM file:$pom.canonicalPath is created"
417-
418-
final buildDirName = project.buildDir.name
419-
final classesDirName = project.compileGroovy.destinationDir.canonicalPath.replace( '\\', '/' ) -
420-
"${ project.buildDir.canonicalPath.replace( '\\', '/' ) }/"
421-
422-
println "classesDirName = [$classesDirName]"
415+
assert pom.file, "[$pom.canonicalPath] was not generated"
416+
println "POM is generated at file:$pom.canonicalPath"
423417

424418
pom.text = pom.text.
425419
replace( '<groupId>unknown</groupId>', "<groupId>${project.group}</groupId>" ).
@@ -428,8 +422,8 @@ project('artifactory-maven-plugin') {
428422
|<version>${version}</version>
429423
| <packaging>maven-plugin</packaging>
430424
| <build>
431-
| <directory>\${project.basedir}/$buildDirName</directory>
432-
| <outputDirectory>\${project.build.directory}/$classesDirName</outputDirectory>
425+
| <directory>${project.buildDir.canonicalPath}</directory>
426+
| <outputDirectory>${project.compileGroovy.destinationDir.canonicalPath}</outputDirectory>
433427
| </build>""".stripMargin().trim())
434428

435429
println "Running '$mvn' with arguments $allArgs"

0 commit comments

Comments
 (0)