maven: how to specify “systemPath” for dependencied installed locally?











up vote
0
down vote

favorite












I've got one myPackage maven project, compiled and installed to local maven repository under



~/.m2/repository/mygroup/myPackage/1.0-SNAPSHOT/myPackage-1.0-SNAPSHOT.jar


In another maven project, I wish to use it, and in pom.xml I write <dependency> section for it. But I don't know how to write the "systemPath" for this jar:




  1. I cannot use "~" to specify the path, because "~" is a *nix shell extention, java/maven cannot recognize it.



  2. I cannot hard code like



    /home/myself/.m2/...


    It's not portable.



  3. I cannot use ${project.basedir} because these 2 maven projects are under different folders. But I guess there should be some other maven environment variables that could indicate "home directory"?



All I wish to do is to get this "systemPath" done.



---------------Problem solved by using another project as dependency------------



<systemPath>${project.basedir}/../myPackage/pom.xml</systemPath>


That works!










share|improve this question




















  • 3




    just creating a dependency in pom.xml should do the job.
    – Pushpesh Kumar Rajwanshi
    Nov 10 at 12:28










  • just adding dependency would first check whether it is available at .m2 repository / if you are using any IDE like eclipse you can add jar manually .
    – Hrudayanath
    Nov 10 at 12:33















up vote
0
down vote

favorite












I've got one myPackage maven project, compiled and installed to local maven repository under



~/.m2/repository/mygroup/myPackage/1.0-SNAPSHOT/myPackage-1.0-SNAPSHOT.jar


In another maven project, I wish to use it, and in pom.xml I write <dependency> section for it. But I don't know how to write the "systemPath" for this jar:




  1. I cannot use "~" to specify the path, because "~" is a *nix shell extention, java/maven cannot recognize it.



  2. I cannot hard code like



    /home/myself/.m2/...


    It's not portable.



  3. I cannot use ${project.basedir} because these 2 maven projects are under different folders. But I guess there should be some other maven environment variables that could indicate "home directory"?



All I wish to do is to get this "systemPath" done.



---------------Problem solved by using another project as dependency------------



<systemPath>${project.basedir}/../myPackage/pom.xml</systemPath>


That works!










share|improve this question




















  • 3




    just creating a dependency in pom.xml should do the job.
    – Pushpesh Kumar Rajwanshi
    Nov 10 at 12:28










  • just adding dependency would first check whether it is available at .m2 repository / if you are using any IDE like eclipse you can add jar manually .
    – Hrudayanath
    Nov 10 at 12:33













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I've got one myPackage maven project, compiled and installed to local maven repository under



~/.m2/repository/mygroup/myPackage/1.0-SNAPSHOT/myPackage-1.0-SNAPSHOT.jar


In another maven project, I wish to use it, and in pom.xml I write <dependency> section for it. But I don't know how to write the "systemPath" for this jar:




  1. I cannot use "~" to specify the path, because "~" is a *nix shell extention, java/maven cannot recognize it.



  2. I cannot hard code like



    /home/myself/.m2/...


    It's not portable.



  3. I cannot use ${project.basedir} because these 2 maven projects are under different folders. But I guess there should be some other maven environment variables that could indicate "home directory"?



All I wish to do is to get this "systemPath" done.



---------------Problem solved by using another project as dependency------------



<systemPath>${project.basedir}/../myPackage/pom.xml</systemPath>


That works!










share|improve this question















I've got one myPackage maven project, compiled and installed to local maven repository under



~/.m2/repository/mygroup/myPackage/1.0-SNAPSHOT/myPackage-1.0-SNAPSHOT.jar


In another maven project, I wish to use it, and in pom.xml I write <dependency> section for it. But I don't know how to write the "systemPath" for this jar:




  1. I cannot use "~" to specify the path, because "~" is a *nix shell extention, java/maven cannot recognize it.



  2. I cannot hard code like



    /home/myself/.m2/...


    It's not portable.



  3. I cannot use ${project.basedir} because these 2 maven projects are under different folders. But I guess there should be some other maven environment variables that could indicate "home directory"?



All I wish to do is to get this "systemPath" done.



---------------Problem solved by using another project as dependency------------



<systemPath>${project.basedir}/../myPackage/pom.xml</systemPath>


That works!







java maven dependencies repository local






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 2 days ago

























asked Nov 10 at 12:26









Hind Forsum

2,45031537




2,45031537








  • 3




    just creating a dependency in pom.xml should do the job.
    – Pushpesh Kumar Rajwanshi
    Nov 10 at 12:28










  • just adding dependency would first check whether it is available at .m2 repository / if you are using any IDE like eclipse you can add jar manually .
    – Hrudayanath
    Nov 10 at 12:33














  • 3




    just creating a dependency in pom.xml should do the job.
    – Pushpesh Kumar Rajwanshi
    Nov 10 at 12:28










  • just adding dependency would first check whether it is available at .m2 repository / if you are using any IDE like eclipse you can add jar manually .
    – Hrudayanath
    Nov 10 at 12:33








3




3




just creating a dependency in pom.xml should do the job.
– Pushpesh Kumar Rajwanshi
Nov 10 at 12:28




just creating a dependency in pom.xml should do the job.
– Pushpesh Kumar Rajwanshi
Nov 10 at 12:28












just adding dependency would first check whether it is available at .m2 repository / if you are using any IDE like eclipse you can add jar manually .
– Hrudayanath
Nov 10 at 12:33




just adding dependency would first check whether it is available at .m2 repository / if you are using any IDE like eclipse you can add jar manually .
– Hrudayanath
Nov 10 at 12:33












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










A system path is required when the library that your project depends on is not in the maven local repository.



As a rule of thumb, this approach is indeed not portable at all and should be avoided for real projects.



Now, the dependency is in local repository if:




  • It was downloaded from some remote repository (usually)


  • You've installed it locally (in this case its in your local repository but might not be in your team-mate repo)



In order to install the dependency into the local repo consider using: mvn install:install-file+ parameters as written here



But from your question, it looks like the file is already there... Anyway once the file is in the local repository you can just define a "regular" dependency (group, artifact, version) and Maven will pick it, no need to fiddle with system Path in this case.






share|improve this answer























    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',
    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%2f53238933%2fmaven-how-to-specify-systempath-for-dependencied-installed-locally%23new-answer', 'question_page');
    }
    );

    Post as a guest
































    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    A system path is required when the library that your project depends on is not in the maven local repository.



    As a rule of thumb, this approach is indeed not portable at all and should be avoided for real projects.



    Now, the dependency is in local repository if:




    • It was downloaded from some remote repository (usually)


    • You've installed it locally (in this case its in your local repository but might not be in your team-mate repo)



    In order to install the dependency into the local repo consider using: mvn install:install-file+ parameters as written here



    But from your question, it looks like the file is already there... Anyway once the file is in the local repository you can just define a "regular" dependency (group, artifact, version) and Maven will pick it, no need to fiddle with system Path in this case.






    share|improve this answer



























      up vote
      1
      down vote



      accepted










      A system path is required when the library that your project depends on is not in the maven local repository.



      As a rule of thumb, this approach is indeed not portable at all and should be avoided for real projects.



      Now, the dependency is in local repository if:




      • It was downloaded from some remote repository (usually)


      • You've installed it locally (in this case its in your local repository but might not be in your team-mate repo)



      In order to install the dependency into the local repo consider using: mvn install:install-file+ parameters as written here



      But from your question, it looks like the file is already there... Anyway once the file is in the local repository you can just define a "regular" dependency (group, artifact, version) and Maven will pick it, no need to fiddle with system Path in this case.






      share|improve this answer

























        up vote
        1
        down vote



        accepted







        up vote
        1
        down vote



        accepted






        A system path is required when the library that your project depends on is not in the maven local repository.



        As a rule of thumb, this approach is indeed not portable at all and should be avoided for real projects.



        Now, the dependency is in local repository if:




        • It was downloaded from some remote repository (usually)


        • You've installed it locally (in this case its in your local repository but might not be in your team-mate repo)



        In order to install the dependency into the local repo consider using: mvn install:install-file+ parameters as written here



        But from your question, it looks like the file is already there... Anyway once the file is in the local repository you can just define a "regular" dependency (group, artifact, version) and Maven will pick it, no need to fiddle with system Path in this case.






        share|improve this answer














        A system path is required when the library that your project depends on is not in the maven local repository.



        As a rule of thumb, this approach is indeed not portable at all and should be avoided for real projects.



        Now, the dependency is in local repository if:




        • It was downloaded from some remote repository (usually)


        • You've installed it locally (in this case its in your local repository but might not be in your team-mate repo)



        In order to install the dependency into the local repo consider using: mvn install:install-file+ parameters as written here



        But from your question, it looks like the file is already there... Anyway once the file is in the local repository you can just define a "regular" dependency (group, artifact, version) and Maven will pick it, no need to fiddle with system Path in this case.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 2 days ago

























        answered 2 days ago









        Mark Bramnik

        11.1k32345




        11.1k32345






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53238933%2fmaven-how-to-specify-systempath-for-dependencied-installed-locally%23new-answer', 'question_page');
            }
            );

            Post as a guest




















































































            Popular posts from this blog

            Florida Star v. B. J. F.

            Error while running script in elastic search , gateway timeout

            Adding quotations to stringified JSON object values