Issue
I see in my default build.gradle
, generated by IDEA
, that group and version were set with:
group 'com.mycompany.mytopic'
version '1.0-SNAPSHOT'
How to set artifact id?
<groupId>com.mycompany.mytopic</groupId>
<artifactId>my-snippets</artifactId>
<version>1.0-SNAPSHOT</version>
How to do the same in Gradle
?
I saw advise to write
rootProject.name = 'my-snippets'
but why?
Why don't we write
rootProject.group 'com.inthemoon.snippets'
rootProject.version '1.0-SNAPSHOT'
then?
Solution
the default of artifactId is the project name
in setting.gradle you can set the project name
like below:
rootProject.name = "something"
or you can change it by putting below code in your build.gradle file
publishing {
publications {
mavenJava(MavenPublication) {
artifactId 'your_desired_name'
from components.java
}
}
Answered By - Amir Ziarati
Answer Checked By - Cary Denson (JavaFixing Admin)