Understanding Maven scoping better -
Understanding Maven scoping better -
i have been struggling figure out what's utilize of scoping provided maven mentioned here.
why should not have compile time scoping? real life examples appreciated.
the compile
scoped dependencies used during compilation.
the test
scoped ones -- during tests. have tests using junit, or easymock. not want final artifact have dependency on them, able depend on these libraries while running tests.
those dependencies marked provided
expected on classpath when you're running produced artifact. example: have webapp , have dependency on servlet library. obviously, should not bundle within war file, webapp container have , conflict may occur.
one of reasons have different scopes dependencies different parts of build can depend on different dependencies. example, if compiling code , not executing tests, there no point in having maven downloading test dependencies (if they're not nowadays in local repository, of course). other reason not dependencies need placed in final artifact (whether it's assembly, or war file), of dependencies used during build , testing phases.
maven
Comments
Post a Comment