Different build number in the same module publish grade
up vote
0
down vote
favorite
Currently, we have publishing code for our gradle project. The purpose is depend on condition, we will publish the suitable artifact.
publications {
if (project.plugins.hasPlugin('java')) {
if (!project.plugins.hasPlugin('war')) {
// main jar containing compiled production classes
classesPublication(MavenPublication) {
from components.java
}
} else {
// war for web app sub projects
warPublication(MavenPublication) {
from components.web
}
}
// Java production source files
sourcePublication(MavenPublication) {
from components.java
artifact sourceJar {
classifier 'sources'
}
}
}
if (project.ext.has('buildTestsJar') && project.ext.buildTestsJar) {
// jar containing compiled test classes
testPublication(MavenPublication) {
artifact jarTest
}
// Java test source files
testSourcePublication(MavenPublication) {
from components.java
artifact testSourceJar {
classifier 'test-sources'
}
}
}
}
But the problem is when I use this one, it published successfully but we got different build number for some jars
Different build number for tests and sources jar
I don't know why it's happened. And when I merge 2 publications in test condition into 1. So the tests jar file will have the same build number to the other, I also don't know why.
if (project.ext.has('buildTestsJar') && project.ext.buildTestsJar) {
// Java test source files
testSourcePublication(MavenPublication) {
from components.java
artifact testSourceJar {
classifier 'test-sources'
}
artifact jarTest
}
}
tests jar have same build number
Please help me explain it.
gradle maven-publish
New contributor
King Trần is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
favorite
Currently, we have publishing code for our gradle project. The purpose is depend on condition, we will publish the suitable artifact.
publications {
if (project.plugins.hasPlugin('java')) {
if (!project.plugins.hasPlugin('war')) {
// main jar containing compiled production classes
classesPublication(MavenPublication) {
from components.java
}
} else {
// war for web app sub projects
warPublication(MavenPublication) {
from components.web
}
}
// Java production source files
sourcePublication(MavenPublication) {
from components.java
artifact sourceJar {
classifier 'sources'
}
}
}
if (project.ext.has('buildTestsJar') && project.ext.buildTestsJar) {
// jar containing compiled test classes
testPublication(MavenPublication) {
artifact jarTest
}
// Java test source files
testSourcePublication(MavenPublication) {
from components.java
artifact testSourceJar {
classifier 'test-sources'
}
}
}
}
But the problem is when I use this one, it published successfully but we got different build number for some jars
Different build number for tests and sources jar
I don't know why it's happened. And when I merge 2 publications in test condition into 1. So the tests jar file will have the same build number to the other, I also don't know why.
if (project.ext.has('buildTestsJar') && project.ext.buildTestsJar) {
// Java test source files
testSourcePublication(MavenPublication) {
from components.java
artifact testSourceJar {
classifier 'test-sources'
}
artifact jarTest
}
}
tests jar have same build number
Please help me explain it.
gradle maven-publish
New contributor
King Trần is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Currently, we have publishing code for our gradle project. The purpose is depend on condition, we will publish the suitable artifact.
publications {
if (project.plugins.hasPlugin('java')) {
if (!project.plugins.hasPlugin('war')) {
// main jar containing compiled production classes
classesPublication(MavenPublication) {
from components.java
}
} else {
// war for web app sub projects
warPublication(MavenPublication) {
from components.web
}
}
// Java production source files
sourcePublication(MavenPublication) {
from components.java
artifact sourceJar {
classifier 'sources'
}
}
}
if (project.ext.has('buildTestsJar') && project.ext.buildTestsJar) {
// jar containing compiled test classes
testPublication(MavenPublication) {
artifact jarTest
}
// Java test source files
testSourcePublication(MavenPublication) {
from components.java
artifact testSourceJar {
classifier 'test-sources'
}
}
}
}
But the problem is when I use this one, it published successfully but we got different build number for some jars
Different build number for tests and sources jar
I don't know why it's happened. And when I merge 2 publications in test condition into 1. So the tests jar file will have the same build number to the other, I also don't know why.
if (project.ext.has('buildTestsJar') && project.ext.buildTestsJar) {
// Java test source files
testSourcePublication(MavenPublication) {
from components.java
artifact testSourceJar {
classifier 'test-sources'
}
artifact jarTest
}
}
tests jar have same build number
Please help me explain it.
gradle maven-publish
New contributor
King Trần is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Currently, we have publishing code for our gradle project. The purpose is depend on condition, we will publish the suitable artifact.
publications {
if (project.plugins.hasPlugin('java')) {
if (!project.plugins.hasPlugin('war')) {
// main jar containing compiled production classes
classesPublication(MavenPublication) {
from components.java
}
} else {
// war for web app sub projects
warPublication(MavenPublication) {
from components.web
}
}
// Java production source files
sourcePublication(MavenPublication) {
from components.java
artifact sourceJar {
classifier 'sources'
}
}
}
if (project.ext.has('buildTestsJar') && project.ext.buildTestsJar) {
// jar containing compiled test classes
testPublication(MavenPublication) {
artifact jarTest
}
// Java test source files
testSourcePublication(MavenPublication) {
from components.java
artifact testSourceJar {
classifier 'test-sources'
}
}
}
}
But the problem is when I use this one, it published successfully but we got different build number for some jars
Different build number for tests and sources jar
I don't know why it's happened. And when I merge 2 publications in test condition into 1. So the tests jar file will have the same build number to the other, I also don't know why.
if (project.ext.has('buildTestsJar') && project.ext.buildTestsJar) {
// Java test source files
testSourcePublication(MavenPublication) {
from components.java
artifact testSourceJar {
classifier 'test-sources'
}
artifact jarTest
}
}
tests jar have same build number
Please help me explain it.
gradle maven-publish
gradle maven-publish
New contributor
King Trần is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
King Trần is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
King Trần is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 2 mins ago
King Trần
11
11
New contributor
King Trần is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
King Trần is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
King Trần is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
King Trần is a new contributor. Be nice, and check out our Code of Conduct.
King Trần is a new contributor. Be nice, and check out our Code of Conduct.
King Trần is a new contributor. Be nice, and check out our Code of Conduct.
King Trần is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53371601%2fdifferent-build-number-in-the-same-module-publish-grade%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown