maven dependency on uber jar, local vs jenkins
I have project A that uses a certain 3rd party repository and dependent on a few jars from that repo.
I compile Project A with dependencies(a fat Jar) and upload it to my artifactory.
Now i start project B, but i dont want him to have that 3rd party repo, because all the classes i need are already in that fat jar i have in the artifactory.
So i only add a dependency for project A in project B ( project B has my artifactory as a repo)
When i build project B at my jenkins server, everything goes well, but when i try to compile project B on my local computer ( that has access to artifactory) i fail cause he tries to download some dependencies of project A while not having the 3rd party repository.
I am well aware that its not the best way to work, but what i dont get is why on my local environment i get the error while the jenkins doesnt?
I thought if the classes exists maven wont try to download the dependencies from an external repo, and the classes exists in my case, if i go into my local .m2 repo, and look at projects As jar, i can see the classes are present.
Why did jenkins succeed the build and i didnt?
maven jenkins dependencies repository
add a comment |
I have project A that uses a certain 3rd party repository and dependent on a few jars from that repo.
I compile Project A with dependencies(a fat Jar) and upload it to my artifactory.
Now i start project B, but i dont want him to have that 3rd party repo, because all the classes i need are already in that fat jar i have in the artifactory.
So i only add a dependency for project A in project B ( project B has my artifactory as a repo)
When i build project B at my jenkins server, everything goes well, but when i try to compile project B on my local computer ( that has access to artifactory) i fail cause he tries to download some dependencies of project A while not having the 3rd party repository.
I am well aware that its not the best way to work, but what i dont get is why on my local environment i get the error while the jenkins doesnt?
I thought if the classes exists maven wont try to download the dependencies from an external repo, and the classes exists in my case, if i go into my local .m2 repo, and look at projects As jar, i can see the classes are present.
Why did jenkins succeed the build and i didnt?
maven jenkins dependencies repository
1
Let me just mention that using a fat jar as dependency is usually a bad idea. More so, if the pom.xml of the fat jar still contains all the dependencies so that Maven will try to download them, effectively duplicating your loaded classes
– JF Meier
Nov 20 at 15:40
add a comment |
I have project A that uses a certain 3rd party repository and dependent on a few jars from that repo.
I compile Project A with dependencies(a fat Jar) and upload it to my artifactory.
Now i start project B, but i dont want him to have that 3rd party repo, because all the classes i need are already in that fat jar i have in the artifactory.
So i only add a dependency for project A in project B ( project B has my artifactory as a repo)
When i build project B at my jenkins server, everything goes well, but when i try to compile project B on my local computer ( that has access to artifactory) i fail cause he tries to download some dependencies of project A while not having the 3rd party repository.
I am well aware that its not the best way to work, but what i dont get is why on my local environment i get the error while the jenkins doesnt?
I thought if the classes exists maven wont try to download the dependencies from an external repo, and the classes exists in my case, if i go into my local .m2 repo, and look at projects As jar, i can see the classes are present.
Why did jenkins succeed the build and i didnt?
maven jenkins dependencies repository
I have project A that uses a certain 3rd party repository and dependent on a few jars from that repo.
I compile Project A with dependencies(a fat Jar) and upload it to my artifactory.
Now i start project B, but i dont want him to have that 3rd party repo, because all the classes i need are already in that fat jar i have in the artifactory.
So i only add a dependency for project A in project B ( project B has my artifactory as a repo)
When i build project B at my jenkins server, everything goes well, but when i try to compile project B on my local computer ( that has access to artifactory) i fail cause he tries to download some dependencies of project A while not having the 3rd party repository.
I am well aware that its not the best way to work, but what i dont get is why on my local environment i get the error while the jenkins doesnt?
I thought if the classes exists maven wont try to download the dependencies from an external repo, and the classes exists in my case, if i go into my local .m2 repo, and look at projects As jar, i can see the classes are present.
Why did jenkins succeed the build and i didnt?
maven jenkins dependencies repository
maven jenkins dependencies repository
asked Nov 20 at 15:01
sharon gur
12913
12913
1
Let me just mention that using a fat jar as dependency is usually a bad idea. More so, if the pom.xml of the fat jar still contains all the dependencies so that Maven will try to download them, effectively duplicating your loaded classes
– JF Meier
Nov 20 at 15:40
add a comment |
1
Let me just mention that using a fat jar as dependency is usually a bad idea. More so, if the pom.xml of the fat jar still contains all the dependencies so that Maven will try to download them, effectively duplicating your loaded classes
– JF Meier
Nov 20 at 15:40
1
1
Let me just mention that using a fat jar as dependency is usually a bad idea. More so, if the pom.xml of the fat jar still contains all the dependencies so that Maven will try to download them, effectively duplicating your loaded classes
– JF Meier
Nov 20 at 15:40
Let me just mention that using a fat jar as dependency is usually a bad idea. More so, if the pom.xml of the fat jar still contains all the dependencies so that Maven will try to download them, effectively duplicating your loaded classes
– JF Meier
Nov 20 at 15:40
add a comment |
1 Answer
1
active
oldest
votes
If you use the same Jenkins node to build your project B where you have built project A initially then Maven is using A's dependencies from local Maven repository. Try to clean it and then build project B there - does the job still succeed?
You may use following dependency declaration in project B to exclude ALL transitive dependencies of A:
<dependency>
<groupId>groupA</groupId>
<artifactId>artifactA</artifactId>
<excludes>
<exclude>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclude>
</excludes>
</dependency>
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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%2f53395815%2fmaven-dependency-on-uber-jar-local-vs-jenkins%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you use the same Jenkins node to build your project B where you have built project A initially then Maven is using A's dependencies from local Maven repository. Try to clean it and then build project B there - does the job still succeed?
You may use following dependency declaration in project B to exclude ALL transitive dependencies of A:
<dependency>
<groupId>groupA</groupId>
<artifactId>artifactA</artifactId>
<excludes>
<exclude>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclude>
</excludes>
</dependency>
add a comment |
If you use the same Jenkins node to build your project B where you have built project A initially then Maven is using A's dependencies from local Maven repository. Try to clean it and then build project B there - does the job still succeed?
You may use following dependency declaration in project B to exclude ALL transitive dependencies of A:
<dependency>
<groupId>groupA</groupId>
<artifactId>artifactA</artifactId>
<excludes>
<exclude>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclude>
</excludes>
</dependency>
add a comment |
If you use the same Jenkins node to build your project B where you have built project A initially then Maven is using A's dependencies from local Maven repository. Try to clean it and then build project B there - does the job still succeed?
You may use following dependency declaration in project B to exclude ALL transitive dependencies of A:
<dependency>
<groupId>groupA</groupId>
<artifactId>artifactA</artifactId>
<excludes>
<exclude>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclude>
</excludes>
</dependency>
If you use the same Jenkins node to build your project B where you have built project A initially then Maven is using A's dependencies from local Maven repository. Try to clean it and then build project B there - does the job still succeed?
You may use following dependency declaration in project B to exclude ALL transitive dependencies of A:
<dependency>
<groupId>groupA</groupId>
<artifactId>artifactA</artifactId>
<excludes>
<exclude>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclude>
</excludes>
</dependency>
answered Nov 20 at 15:35
Illya Kysil
703411
703411
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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%2f53395815%2fmaven-dependency-on-uber-jar-local-vs-jenkins%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
1
Let me just mention that using a fat jar as dependency is usually a bad idea. More so, if the pom.xml of the fat jar still contains all the dependencies so that Maven will try to download them, effectively duplicating your loaded classes
– JF Meier
Nov 20 at 15:40