How to overwrite artifactId for Android Gradle lib

2019-04-10 22:31发布

I created an Android library project using Android Studio with the following directory structure:

├── build.gradle
├── gradle
├── gradle.properties
├── gradlew
├── gradlew.bat
├── local.properties
├── settings.gradle
├── FooBar.iml
└── FooBar Library

When I want to publish the library to my local Maven repository I encounter the following error:

Execution failed for task ':Foobar Library:publishMavenPublicationToMavenLocal'.
> Failed to publish publication 'maven' to repository 'MavenLocal'
   > Invalid publication 'maven': 
     artifactId is not a valid Maven identifier ([A-Za-z0-9_\-.]+).

Please notice that the folder "FooBar Library" contains a space. How can I set the artifactId for Gradle so I can overwrite the default artifactId?


Side note: If you are using uploadArchives in favor of maven-publish you can rename the artifactId setting archivesBaseName as follows:

archivesBaseName = "foobar-library"

0条回答
登录 后发表回答