fernando1979
fernando1979

Reputation: 1947

Maven takes dependency from workspace and not from local repository

I have a web maven project in eclipse, one of its dependencies is a j2se maven project that I have in the same workspace. Something curious to me is that I believed that all dependencies declared in a maven project were taken from the remote repository or a local repository but its not, I mean; even I havent done a maven install to my j2se java project(so its not located in the local repository), when I create a war from the web project this jar is included.

  1. I think this behaviour is because of eclipse and not maven and eclipse will always takes this dependency from the workspace

2 Because of this I can change the j2se project and not have to do a maven install ever to this project,

  1. From the point of view of maven, I should do a maven install to my j2se project in order the web project takes the dependency from the repository and not from workspace, right?

Thanks

Upvotes: 0

Views: 934

Answers (1)

coderplus
coderplus

Reputation: 5913

Yes, Eclipse m2e will by default try to resolve dependencies from the workspace. In case it's not present in the workspace, it will try to resolve it from the ArtifactRepositories(your local and remote repos).

In case you want to turn off the workspace resolution, you can do that by right clicking on the Project and selecting Maven.If you uncheck that check-box, the dependencies for that particular project won't be resolved from the workspace.

disable workspace resolution of dependencies

Upvotes: 2

Related Questions