I want to exclude .svn
folders when I publish my plugin to our custom Artifactory repository. I'm assuming the inclusion of .svn
folders is the issue based on the error strack trace provided below.
I'm publishing using the following command:
gradlew artifactoryPublish --stacktrace
This is the publishing block in build.gradle
:
artifactory {
contextUrl = artifactory_context
publish {
repository {
repoKey = 'plugins-release-local'
username = artifactory_user
password = artifactory_password
maven = true
}
defaults {
publications ('mavenJava')
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
}
This is the stack trace I get when I attempt to publish, notice the attempt copy of .svn/entries
to assets/entries
.
...
:copyAssets FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':copyAssets'.
> Could not copy file '/u01/var/build/pluginXYZ/grails-app/assets/.svn/entries' to '/u01/var/build/pluginXYZ/build/resources/main/META-INF/assets/entries'.
* Try:
Run with --info or --debug option to get more log output.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':copyAssets'.
...
Caused by: org.gradle.api.GradleException: Could not copy file '/u01/var/build/pluginXYZ/grails-app/assets/.svn/entries' to '/u01/var/build/pluginXYZ/build/resources/main/META-INF/assets/entries'.
...
Caused by: java.io.FileNotFoundException: /u01/var/build/pluginXYZ/build/resources/main/META-INF/assets/entries (Permission denied)
... 80 more
The permission on entries
(both trees) are -r--r--r--
.
If I exclude those folders, I should get rid of said permission issue. The first checkout will always publish, but subsequent publishes (say after an update), fail with this error.
Update #2
Here are the three combination I tried without success:
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
//first attempt
//exclude("**/.svn/**")
//second attempt
//exclude{ details -> details.file.name.contains(".svn") }
//third attempt
//exclude "**/.svn/**"
}
}
}
The error output when publishing, using all three attempts, is the following:
Caused by: org.gradle.api.internal.MissingMethodException: Could not find method exclude() for arguments [build_3nsvrqvwahy23ir3fxdj970id$_run_closure7_closure13_closure14_closure15@10e9a5fe] on org.gradlpublish.maven.internal.publication.DefaultMavenPublication_Decorated@ca7e37f.
Update #3
I found the following link taking about excluding files.
I then adjusted my gradle.build
to this:
publishing {
publications {
mavenJava(MavenPublication) {
from components.java {
exclude "**/.svn/**"
}
}
}
}
Same error.
Update #4
More attempts... same results
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourceJar{
exclude '**/.svn/**'
}
}
}
}
or
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact exclude '**/.svn/**'
}
}
}
I appended the following at the root level in my build.gradle
and it seems to work:
sourceSets {
main {
java {
exclude '**/.svn/**'
}
}
}