How can I have a multi-module Maven project without specifying the version all over the place?How do I tell Maven to use the latest version of a dependency?How can I create an executable JAR with dependencies using Maven?Maven Modules + Building a Single Specific ModuleHow to add local jar files to a Maven project?Updating version numbers of modules in a multi-module Maven projectIntelliJ inspection gives “Cannot resolve symbol” but still compiles codeIntelliJ - Convert a Java project/module into a Maven project/moduleDealing with “Xerces hell” in Java/Maven?Maven is not working in Java 8 when Javadoc tags are incompleteHow can I make IntelliJ IDEA update my dependencies from Maven?

Inclusion of standard error in regression equation

The art of clickbait captions

Is it rude to call a professor by their last name with no prefix in a non-academic setting?

Did 20% of US soldiers in Vietnam use heroin, 95% of whom quit afterwards?

Why did David Cameron offer a referendum on the European Union?

Can a person survive on blood in place of water?

What are the real benefits of using Salesforce DX?

Pirate democracy at its finest

Did people Unsnap to where they were?

Count Even Digits In Number

Employer demanding to see degree after poor code review

Do photons bend spacetime or not?

How to know if a folder is a symbolic link?

Why does Mjolnir fall down in Age of Ultron but not in Endgame?

What is the object moving across the ceiling in this stock footage?

Should I disclose a colleague's illness (that I should not know) when others badmouth him

Make 24 using exactly three 3s

Is the Indo-European language family made up?

How strong are Wi-Fi signals?

Is the derivative with respect to a fermion field Grassmann-odd?

Gladys goes shopping

Where can I find visible/radio telescopic observations of the center of the Milky Way galaxy?

How to respond to an upset student?

Why do Ryanair allow me to book connecting itineraries through a third party, but not through their own website?



How can I have a multi-module Maven project without specifying the version all over the place?


How do I tell Maven to use the latest version of a dependency?How can I create an executable JAR with dependencies using Maven?Maven Modules + Building a Single Specific ModuleHow to add local jar files to a Maven project?Updating version numbers of modules in a multi-module Maven projectIntelliJ inspection gives “Cannot resolve symbol” but still compiles codeIntelliJ - Convert a Java project/module into a Maven project/moduleDealing with “Xerces hell” in Java/Maven?Maven is not working in Java 8 when Javadoc tags are incompleteHow can I make IntelliJ IDEA update my dependencies from Maven?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am currently learning Maven for a specific project. In this project, I need to have multiple modules (in the sense of a collection of classes and resources) that depend on each-other. Specifically, I need a module to store the classes of a public-facing API (the API is a Java API, as the desktop program can load addons at runtime), another for a set of common classes that are shared between the client and server but that are not part of the API, and of course the client and server themselves need a module each.



Using the system that I used before Maven (IntelliJ Idea's build system), I would simply create different modules and setup dependencies using IntelliJ's GUI. This works well because I can then put the whole IntelliJ Idea project in a git repository, and keep everything nicely tracked together with no fuss and no problems.



When researching how to do this in Maven, however, I ran into some problems. Maven's documentation has a section that seems to explain how to accomplish something similar, but its technique seems to have two problems. When Each sub-project, with its own pom.xml, needs to specify the version of the other sub-projects that it depends on¹. This implies that I need to make many changes all over the project whenever the version changes. This will (hopefully) be quite frequent. As it is perfectly plausible that my project will grow to have hundreds of modules, this is obviously impractical.



Additionally, based on my other research, it seems like a Maven repository is involved in the documented technique. Specifically, it seems like when, for example, the API module is built to be included in the client and server modules it will first be placed in a local repository and then the client and server modules will retrieve it from there. This sounds problematic as the API module will also be published in a public repository (maybe Maven central, I haven't really thought about this too much -- but it will be public in a repo), and this repository step seems like it could end up building the client and server with a published jar rather than the local one, which is problematic for many reasons. (eg. if a developer is making local changes to the api jar, building half the project without those changes is a problem).



Is there some better way to combine multiple modules to mitigate these problems (versions all over the place, and getting wrong jars from repos)? Is it better to modify the technique in the linked documentation instead? Am I misunderstanding something and the problems don't exist?



I have checked DuckDuckGo and all relevant questions that I can find on StackOverflow, and none address either of the two aforementioned problems.



¹:



 <dependencies>
<dependency>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>









share|improve this question






















  • If all your subprojects increment their versions in sync with each other, then your project structure is probably wrong and what you call subprojects are really just modules within a single project. The point of dependencies is to allow each project to have its own development trajectory. If B depends on A, then it uses A's API. When A publishes a new version you don't want B to automatically get the new version of A until you've confirmed the changes in A don't break B.

    – Jim Garrison
    Mar 24 at 4:38











  • @JimGarrison They absolutely are modules within a single project, but Maven's documentation suggests to me that the best way to handle that is with the technique in the linked documentation. For example, the first sentence in that link is "The concept of dealing with multiple modules is built in to Maven," which clearly talks about modules. I am 100% open to better ways to do this with Maven, however.

    – john01dav
    Mar 24 at 4:46

















0















I am currently learning Maven for a specific project. In this project, I need to have multiple modules (in the sense of a collection of classes and resources) that depend on each-other. Specifically, I need a module to store the classes of a public-facing API (the API is a Java API, as the desktop program can load addons at runtime), another for a set of common classes that are shared between the client and server but that are not part of the API, and of course the client and server themselves need a module each.



Using the system that I used before Maven (IntelliJ Idea's build system), I would simply create different modules and setup dependencies using IntelliJ's GUI. This works well because I can then put the whole IntelliJ Idea project in a git repository, and keep everything nicely tracked together with no fuss and no problems.



When researching how to do this in Maven, however, I ran into some problems. Maven's documentation has a section that seems to explain how to accomplish something similar, but its technique seems to have two problems. When Each sub-project, with its own pom.xml, needs to specify the version of the other sub-projects that it depends on¹. This implies that I need to make many changes all over the project whenever the version changes. This will (hopefully) be quite frequent. As it is perfectly plausible that my project will grow to have hundreds of modules, this is obviously impractical.



Additionally, based on my other research, it seems like a Maven repository is involved in the documented technique. Specifically, it seems like when, for example, the API module is built to be included in the client and server modules it will first be placed in a local repository and then the client and server modules will retrieve it from there. This sounds problematic as the API module will also be published in a public repository (maybe Maven central, I haven't really thought about this too much -- but it will be public in a repo), and this repository step seems like it could end up building the client and server with a published jar rather than the local one, which is problematic for many reasons. (eg. if a developer is making local changes to the api jar, building half the project without those changes is a problem).



Is there some better way to combine multiple modules to mitigate these problems (versions all over the place, and getting wrong jars from repos)? Is it better to modify the technique in the linked documentation instead? Am I misunderstanding something and the problems don't exist?



I have checked DuckDuckGo and all relevant questions that I can find on StackOverflow, and none address either of the two aforementioned problems.



¹:



 <dependencies>
<dependency>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>









share|improve this question






















  • If all your subprojects increment their versions in sync with each other, then your project structure is probably wrong and what you call subprojects are really just modules within a single project. The point of dependencies is to allow each project to have its own development trajectory. If B depends on A, then it uses A's API. When A publishes a new version you don't want B to automatically get the new version of A until you've confirmed the changes in A don't break B.

    – Jim Garrison
    Mar 24 at 4:38











  • @JimGarrison They absolutely are modules within a single project, but Maven's documentation suggests to me that the best way to handle that is with the technique in the linked documentation. For example, the first sentence in that link is "The concept of dealing with multiple modules is built in to Maven," which clearly talks about modules. I am 100% open to better ways to do this with Maven, however.

    – john01dav
    Mar 24 at 4:46













0












0








0








I am currently learning Maven for a specific project. In this project, I need to have multiple modules (in the sense of a collection of classes and resources) that depend on each-other. Specifically, I need a module to store the classes of a public-facing API (the API is a Java API, as the desktop program can load addons at runtime), another for a set of common classes that are shared between the client and server but that are not part of the API, and of course the client and server themselves need a module each.



Using the system that I used before Maven (IntelliJ Idea's build system), I would simply create different modules and setup dependencies using IntelliJ's GUI. This works well because I can then put the whole IntelliJ Idea project in a git repository, and keep everything nicely tracked together with no fuss and no problems.



When researching how to do this in Maven, however, I ran into some problems. Maven's documentation has a section that seems to explain how to accomplish something similar, but its technique seems to have two problems. When Each sub-project, with its own pom.xml, needs to specify the version of the other sub-projects that it depends on¹. This implies that I need to make many changes all over the project whenever the version changes. This will (hopefully) be quite frequent. As it is perfectly plausible that my project will grow to have hundreds of modules, this is obviously impractical.



Additionally, based on my other research, it seems like a Maven repository is involved in the documented technique. Specifically, it seems like when, for example, the API module is built to be included in the client and server modules it will first be placed in a local repository and then the client and server modules will retrieve it from there. This sounds problematic as the API module will also be published in a public repository (maybe Maven central, I haven't really thought about this too much -- but it will be public in a repo), and this repository step seems like it could end up building the client and server with a published jar rather than the local one, which is problematic for many reasons. (eg. if a developer is making local changes to the api jar, building half the project without those changes is a problem).



Is there some better way to combine multiple modules to mitigate these problems (versions all over the place, and getting wrong jars from repos)? Is it better to modify the technique in the linked documentation instead? Am I misunderstanding something and the problems don't exist?



I have checked DuckDuckGo and all relevant questions that I can find on StackOverflow, and none address either of the two aforementioned problems.



¹:



 <dependencies>
<dependency>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>









share|improve this question














I am currently learning Maven for a specific project. In this project, I need to have multiple modules (in the sense of a collection of classes and resources) that depend on each-other. Specifically, I need a module to store the classes of a public-facing API (the API is a Java API, as the desktop program can load addons at runtime), another for a set of common classes that are shared between the client and server but that are not part of the API, and of course the client and server themselves need a module each.



Using the system that I used before Maven (IntelliJ Idea's build system), I would simply create different modules and setup dependencies using IntelliJ's GUI. This works well because I can then put the whole IntelliJ Idea project in a git repository, and keep everything nicely tracked together with no fuss and no problems.



When researching how to do this in Maven, however, I ran into some problems. Maven's documentation has a section that seems to explain how to accomplish something similar, but its technique seems to have two problems. When Each sub-project, with its own pom.xml, needs to specify the version of the other sub-projects that it depends on¹. This implies that I need to make many changes all over the project whenever the version changes. This will (hopefully) be quite frequent. As it is perfectly plausible that my project will grow to have hundreds of modules, this is obviously impractical.



Additionally, based on my other research, it seems like a Maven repository is involved in the documented technique. Specifically, it seems like when, for example, the API module is built to be included in the client and server modules it will first be placed in a local repository and then the client and server modules will retrieve it from there. This sounds problematic as the API module will also be published in a public repository (maybe Maven central, I haven't really thought about this too much -- but it will be public in a repo), and this repository step seems like it could end up building the client and server with a published jar rather than the local one, which is problematic for many reasons. (eg. if a developer is making local changes to the api jar, building half the project without those changes is a problem).



Is there some better way to combine multiple modules to mitigate these problems (versions all over the place, and getting wrong jars from repos)? Is it better to modify the technique in the linked documentation instead? Am I misunderstanding something and the problems don't exist?



I have checked DuckDuckGo and all relevant questions that I can find on StackOverflow, and none address either of the two aforementioned problems.



¹:



 <dependencies>
<dependency>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>






java maven intellij-idea






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 24 at 4:24









john01davjohn01dav

678420




678420












  • If all your subprojects increment their versions in sync with each other, then your project structure is probably wrong and what you call subprojects are really just modules within a single project. The point of dependencies is to allow each project to have its own development trajectory. If B depends on A, then it uses A's API. When A publishes a new version you don't want B to automatically get the new version of A until you've confirmed the changes in A don't break B.

    – Jim Garrison
    Mar 24 at 4:38











  • @JimGarrison They absolutely are modules within a single project, but Maven's documentation suggests to me that the best way to handle that is with the technique in the linked documentation. For example, the first sentence in that link is "The concept of dealing with multiple modules is built in to Maven," which clearly talks about modules. I am 100% open to better ways to do this with Maven, however.

    – john01dav
    Mar 24 at 4:46

















  • If all your subprojects increment their versions in sync with each other, then your project structure is probably wrong and what you call subprojects are really just modules within a single project. The point of dependencies is to allow each project to have its own development trajectory. If B depends on A, then it uses A's API. When A publishes a new version you don't want B to automatically get the new version of A until you've confirmed the changes in A don't break B.

    – Jim Garrison
    Mar 24 at 4:38











  • @JimGarrison They absolutely are modules within a single project, but Maven's documentation suggests to me that the best way to handle that is with the technique in the linked documentation. For example, the first sentence in that link is "The concept of dealing with multiple modules is built in to Maven," which clearly talks about modules. I am 100% open to better ways to do this with Maven, however.

    – john01dav
    Mar 24 at 4:46
















If all your subprojects increment their versions in sync with each other, then your project structure is probably wrong and what you call subprojects are really just modules within a single project. The point of dependencies is to allow each project to have its own development trajectory. If B depends on A, then it uses A's API. When A publishes a new version you don't want B to automatically get the new version of A until you've confirmed the changes in A don't break B.

– Jim Garrison
Mar 24 at 4:38





If all your subprojects increment their versions in sync with each other, then your project structure is probably wrong and what you call subprojects are really just modules within a single project. The point of dependencies is to allow each project to have its own development trajectory. If B depends on A, then it uses A's API. When A publishes a new version you don't want B to automatically get the new version of A until you've confirmed the changes in A don't break B.

– Jim Garrison
Mar 24 at 4:38













@JimGarrison They absolutely are modules within a single project, but Maven's documentation suggests to me that the best way to handle that is with the technique in the linked documentation. For example, the first sentence in that link is "The concept of dealing with multiple modules is built in to Maven," which clearly talks about modules. I am 100% open to better ways to do this with Maven, however.

– john01dav
Mar 24 at 4:46





@JimGarrison They absolutely are modules within a single project, but Maven's documentation suggests to me that the best way to handle that is with the technique in the linked documentation. For example, the first sentence in that link is "The concept of dealing with multiple modules is built in to Maven," which clearly talks about modules. I am 100% open to better ways to do this with Maven, however.

– john01dav
Mar 24 at 4:46












2 Answers
2






active

oldest

votes


















1














In your multi-module project, you usually use just one version for all modules. This means that you can define dependencies between modules with <version>$project.version</version> where the property $project.version$ is resolved during the build. Maven builds all the modules in the correct order.






share|improve this answer























  • Can you provide some more detail on the last point? I think that you are trying to address my concern of getting some of the jars from a public repository, but what you have said is not specific enough for me to know if it solves my problem or how to apply it.

    – john01dav
    Mar 24 at 18:53











  • Your "public repository concern" is not clear to me. When you build all modules, and declare the version as I said, these modules will only use the given version of other modules.

    – JF Meier
    Mar 24 at 18:58











  • My concern is that when, for example, the client module (in the example in the question) attempts to find the jar of the API module, it will find the published one instead of the local one, as they will both have identical versions along the lines of 1.0-SNAPSHOT. When you say that your technique ensures that the correct version of modules are used, are you saying that I am mistaken that what I described is a concern, even if the versions are identical?

    – john01dav
    Mar 24 at 19:04











  • This cannot happen because if A depends on B, then B is build before A, so the 1.0-SNAPSHOT of B will already be the new version when A asks for it.

    – JF Meier
    Mar 24 at 19:12











  • When B is already built and A attempts to find B's jar, what stops it from finding it in a remote repo and then stopping the search, thus never seeing the local B jar?

    – john01dav
    Mar 24 at 19:15


















-1














Regarding your first question: you can create a parent pom over your whole project. In this parent pom you can add a dependencyManagement section where you can list your own modules with their version. In your modules you then only need to specify the dependeny without the version.



Here an example:



in parent pom:



<dependencyManagement>
<dependencies>
<dependency>
<groupId>yourgroup</groupId>
<artifactId>yourmoduleA</artifactId>
<version>3.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>yourgroup</groupId>
<artifactId>yourmoduleB</artifactId>
<version>3.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>


and if your module A uses module B, you can add in pom of module A



 <dependencies>
<dependency>
<groupId>yourgroup</groupId>
<artifactId>yourmoduleB</artifactId>
</dependency>
</dependencies>





share|improve this answer

























  • I am very new to maven. So, while what you are saying makes sense, it isn't detailed enough for me to use. Can you edit your answer to include either more details (with code) or a link to a place where I can find those details?

    – john01dav
    Mar 24 at 7:08











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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55320715%2fhow-can-i-have-a-multi-module-maven-project-without-specifying-the-version-all-o%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














In your multi-module project, you usually use just one version for all modules. This means that you can define dependencies between modules with <version>$project.version</version> where the property $project.version$ is resolved during the build. Maven builds all the modules in the correct order.






share|improve this answer























  • Can you provide some more detail on the last point? I think that you are trying to address my concern of getting some of the jars from a public repository, but what you have said is not specific enough for me to know if it solves my problem or how to apply it.

    – john01dav
    Mar 24 at 18:53











  • Your "public repository concern" is not clear to me. When you build all modules, and declare the version as I said, these modules will only use the given version of other modules.

    – JF Meier
    Mar 24 at 18:58











  • My concern is that when, for example, the client module (in the example in the question) attempts to find the jar of the API module, it will find the published one instead of the local one, as they will both have identical versions along the lines of 1.0-SNAPSHOT. When you say that your technique ensures that the correct version of modules are used, are you saying that I am mistaken that what I described is a concern, even if the versions are identical?

    – john01dav
    Mar 24 at 19:04











  • This cannot happen because if A depends on B, then B is build before A, so the 1.0-SNAPSHOT of B will already be the new version when A asks for it.

    – JF Meier
    Mar 24 at 19:12











  • When B is already built and A attempts to find B's jar, what stops it from finding it in a remote repo and then stopping the search, thus never seeing the local B jar?

    – john01dav
    Mar 24 at 19:15















1














In your multi-module project, you usually use just one version for all modules. This means that you can define dependencies between modules with <version>$project.version</version> where the property $project.version$ is resolved during the build. Maven builds all the modules in the correct order.






share|improve this answer























  • Can you provide some more detail on the last point? I think that you are trying to address my concern of getting some of the jars from a public repository, but what you have said is not specific enough for me to know if it solves my problem or how to apply it.

    – john01dav
    Mar 24 at 18:53











  • Your "public repository concern" is not clear to me. When you build all modules, and declare the version as I said, these modules will only use the given version of other modules.

    – JF Meier
    Mar 24 at 18:58











  • My concern is that when, for example, the client module (in the example in the question) attempts to find the jar of the API module, it will find the published one instead of the local one, as they will both have identical versions along the lines of 1.0-SNAPSHOT. When you say that your technique ensures that the correct version of modules are used, are you saying that I am mistaken that what I described is a concern, even if the versions are identical?

    – john01dav
    Mar 24 at 19:04











  • This cannot happen because if A depends on B, then B is build before A, so the 1.0-SNAPSHOT of B will already be the new version when A asks for it.

    – JF Meier
    Mar 24 at 19:12











  • When B is already built and A attempts to find B's jar, what stops it from finding it in a remote repo and then stopping the search, thus never seeing the local B jar?

    – john01dav
    Mar 24 at 19:15













1












1








1







In your multi-module project, you usually use just one version for all modules. This means that you can define dependencies between modules with <version>$project.version</version> where the property $project.version$ is resolved during the build. Maven builds all the modules in the correct order.






share|improve this answer













In your multi-module project, you usually use just one version for all modules. This means that you can define dependencies between modules with <version>$project.version</version> where the property $project.version$ is resolved during the build. Maven builds all the modules in the correct order.







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 24 at 9:45









JF MeierJF Meier

10.8k53069




10.8k53069












  • Can you provide some more detail on the last point? I think that you are trying to address my concern of getting some of the jars from a public repository, but what you have said is not specific enough for me to know if it solves my problem or how to apply it.

    – john01dav
    Mar 24 at 18:53











  • Your "public repository concern" is not clear to me. When you build all modules, and declare the version as I said, these modules will only use the given version of other modules.

    – JF Meier
    Mar 24 at 18:58











  • My concern is that when, for example, the client module (in the example in the question) attempts to find the jar of the API module, it will find the published one instead of the local one, as they will both have identical versions along the lines of 1.0-SNAPSHOT. When you say that your technique ensures that the correct version of modules are used, are you saying that I am mistaken that what I described is a concern, even if the versions are identical?

    – john01dav
    Mar 24 at 19:04











  • This cannot happen because if A depends on B, then B is build before A, so the 1.0-SNAPSHOT of B will already be the new version when A asks for it.

    – JF Meier
    Mar 24 at 19:12











  • When B is already built and A attempts to find B's jar, what stops it from finding it in a remote repo and then stopping the search, thus never seeing the local B jar?

    – john01dav
    Mar 24 at 19:15

















  • Can you provide some more detail on the last point? I think that you are trying to address my concern of getting some of the jars from a public repository, but what you have said is not specific enough for me to know if it solves my problem or how to apply it.

    – john01dav
    Mar 24 at 18:53











  • Your "public repository concern" is not clear to me. When you build all modules, and declare the version as I said, these modules will only use the given version of other modules.

    – JF Meier
    Mar 24 at 18:58











  • My concern is that when, for example, the client module (in the example in the question) attempts to find the jar of the API module, it will find the published one instead of the local one, as they will both have identical versions along the lines of 1.0-SNAPSHOT. When you say that your technique ensures that the correct version of modules are used, are you saying that I am mistaken that what I described is a concern, even if the versions are identical?

    – john01dav
    Mar 24 at 19:04











  • This cannot happen because if A depends on B, then B is build before A, so the 1.0-SNAPSHOT of B will already be the new version when A asks for it.

    – JF Meier
    Mar 24 at 19:12











  • When B is already built and A attempts to find B's jar, what stops it from finding it in a remote repo and then stopping the search, thus never seeing the local B jar?

    – john01dav
    Mar 24 at 19:15
















Can you provide some more detail on the last point? I think that you are trying to address my concern of getting some of the jars from a public repository, but what you have said is not specific enough for me to know if it solves my problem or how to apply it.

– john01dav
Mar 24 at 18:53





Can you provide some more detail on the last point? I think that you are trying to address my concern of getting some of the jars from a public repository, but what you have said is not specific enough for me to know if it solves my problem or how to apply it.

– john01dav
Mar 24 at 18:53













Your "public repository concern" is not clear to me. When you build all modules, and declare the version as I said, these modules will only use the given version of other modules.

– JF Meier
Mar 24 at 18:58





Your "public repository concern" is not clear to me. When you build all modules, and declare the version as I said, these modules will only use the given version of other modules.

– JF Meier
Mar 24 at 18:58













My concern is that when, for example, the client module (in the example in the question) attempts to find the jar of the API module, it will find the published one instead of the local one, as they will both have identical versions along the lines of 1.0-SNAPSHOT. When you say that your technique ensures that the correct version of modules are used, are you saying that I am mistaken that what I described is a concern, even if the versions are identical?

– john01dav
Mar 24 at 19:04





My concern is that when, for example, the client module (in the example in the question) attempts to find the jar of the API module, it will find the published one instead of the local one, as they will both have identical versions along the lines of 1.0-SNAPSHOT. When you say that your technique ensures that the correct version of modules are used, are you saying that I am mistaken that what I described is a concern, even if the versions are identical?

– john01dav
Mar 24 at 19:04













This cannot happen because if A depends on B, then B is build before A, so the 1.0-SNAPSHOT of B will already be the new version when A asks for it.

– JF Meier
Mar 24 at 19:12





This cannot happen because if A depends on B, then B is build before A, so the 1.0-SNAPSHOT of B will already be the new version when A asks for it.

– JF Meier
Mar 24 at 19:12













When B is already built and A attempts to find B's jar, what stops it from finding it in a remote repo and then stopping the search, thus never seeing the local B jar?

– john01dav
Mar 24 at 19:15





When B is already built and A attempts to find B's jar, what stops it from finding it in a remote repo and then stopping the search, thus never seeing the local B jar?

– john01dav
Mar 24 at 19:15













-1














Regarding your first question: you can create a parent pom over your whole project. In this parent pom you can add a dependencyManagement section where you can list your own modules with their version. In your modules you then only need to specify the dependeny without the version.



Here an example:



in parent pom:



<dependencyManagement>
<dependencies>
<dependency>
<groupId>yourgroup</groupId>
<artifactId>yourmoduleA</artifactId>
<version>3.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>yourgroup</groupId>
<artifactId>yourmoduleB</artifactId>
<version>3.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>


and if your module A uses module B, you can add in pom of module A



 <dependencies>
<dependency>
<groupId>yourgroup</groupId>
<artifactId>yourmoduleB</artifactId>
</dependency>
</dependencies>





share|improve this answer

























  • I am very new to maven. So, while what you are saying makes sense, it isn't detailed enough for me to use. Can you edit your answer to include either more details (with code) or a link to a place where I can find those details?

    – john01dav
    Mar 24 at 7:08















-1














Regarding your first question: you can create a parent pom over your whole project. In this parent pom you can add a dependencyManagement section where you can list your own modules with their version. In your modules you then only need to specify the dependeny without the version.



Here an example:



in parent pom:



<dependencyManagement>
<dependencies>
<dependency>
<groupId>yourgroup</groupId>
<artifactId>yourmoduleA</artifactId>
<version>3.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>yourgroup</groupId>
<artifactId>yourmoduleB</artifactId>
<version>3.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>


and if your module A uses module B, you can add in pom of module A



 <dependencies>
<dependency>
<groupId>yourgroup</groupId>
<artifactId>yourmoduleB</artifactId>
</dependency>
</dependencies>





share|improve this answer

























  • I am very new to maven. So, while what you are saying makes sense, it isn't detailed enough for me to use. Can you edit your answer to include either more details (with code) or a link to a place where I can find those details?

    – john01dav
    Mar 24 at 7:08













-1












-1








-1







Regarding your first question: you can create a parent pom over your whole project. In this parent pom you can add a dependencyManagement section where you can list your own modules with their version. In your modules you then only need to specify the dependeny without the version.



Here an example:



in parent pom:



<dependencyManagement>
<dependencies>
<dependency>
<groupId>yourgroup</groupId>
<artifactId>yourmoduleA</artifactId>
<version>3.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>yourgroup</groupId>
<artifactId>yourmoduleB</artifactId>
<version>3.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>


and if your module A uses module B, you can add in pom of module A



 <dependencies>
<dependency>
<groupId>yourgroup</groupId>
<artifactId>yourmoduleB</artifactId>
</dependency>
</dependencies>





share|improve this answer















Regarding your first question: you can create a parent pom over your whole project. In this parent pom you can add a dependencyManagement section where you can list your own modules with their version. In your modules you then only need to specify the dependeny without the version.



Here an example:



in parent pom:



<dependencyManagement>
<dependencies>
<dependency>
<groupId>yourgroup</groupId>
<artifactId>yourmoduleA</artifactId>
<version>3.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>yourgroup</groupId>
<artifactId>yourmoduleB</artifactId>
<version>3.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
</dependencyManagement>


and if your module A uses module B, you can add in pom of module A



 <dependencies>
<dependency>
<groupId>yourgroup</groupId>
<artifactId>yourmoduleB</artifactId>
</dependency>
</dependencies>






share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 25 at 7:12

























answered Mar 24 at 6:45









rloeffelrloeffel

645




645












  • I am very new to maven. So, while what you are saying makes sense, it isn't detailed enough for me to use. Can you edit your answer to include either more details (with code) or a link to a place where I can find those details?

    – john01dav
    Mar 24 at 7:08

















  • I am very new to maven. So, while what you are saying makes sense, it isn't detailed enough for me to use. Can you edit your answer to include either more details (with code) or a link to a place where I can find those details?

    – john01dav
    Mar 24 at 7:08
















I am very new to maven. So, while what you are saying makes sense, it isn't detailed enough for me to use. Can you edit your answer to include either more details (with code) or a link to a place where I can find those details?

– john01dav
Mar 24 at 7:08





I am very new to maven. So, while what you are saying makes sense, it isn't detailed enough for me to use. Can you edit your answer to include either more details (with code) or a link to a place where I can find those details?

– john01dav
Mar 24 at 7:08

















draft saved

draft discarded
















































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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55320715%2fhow-can-i-have-a-multi-module-maven-project-without-specifying-the-version-all-o%23new-answer', 'question_page');

);

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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현