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:
I cannot use "~" to specify the path, because "~" is a *nix shell extention, java/maven cannot recognize it.
I cannot hard code like
/home/myself/.m2/...
It's not portable.
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
add a comment |
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:
I cannot use "~" to specify the path, because "~" is a *nix shell extention, java/maven cannot recognize it.
I cannot hard code like
/home/myself/.m2/...
It's not portable.
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
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
add a comment |
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:
I cannot use "~" to specify the path, because "~" is a *nix shell extention, java/maven cannot recognize it.
I cannot hard code like
/home/myself/.m2/...
It's not portable.
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
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:
I cannot use "~" to specify the path, because "~" is a *nix shell extention, java/maven cannot recognize it.
I cannot hard code like
/home/myself/.m2/...
It's not portable.
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
java maven dependencies repository local
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
add a comment |
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
add a comment |
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.
add a comment |
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.
add a comment |
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.
add a comment |
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.
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.
edited 2 days ago
answered 2 days ago
Mark Bramnik
11.1k32345
11.1k32345
add a comment |
add a comment |
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
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
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
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
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
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