You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Siddharth Jain <si...@gmail.com> on 2023/10/02 00:47:06 UTC
question on maven dependency scope
hello.
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Scope
- *provided*
This is much like compile, but indicates you expect the JDK or a
container to provide the dependency at runtime. For example, when building
a web application for the Java Enterprise Edition, you would set the
dependency on the Servlet API and related Java EE APIs to scope
provided because
the web container provides those classes. A dependency with this scope is
added to the classpath used for compilation and test, but not the runtime
classpath. It is not transitive.
what does the runtime classpath mean here? does it mean the classpath when
running the application using the maven-exec-plugin? does it make any
difference to the maven-assembly-plugin whether scope is provided or not?
context: I am trying to build an application with different levels of
subscription. there will be a common core but i will provide premium
features as addons. so I want to treat them as dependencies with
provided scope in the core and package the application differently
depending on the customer's subscription level. as the packing into a jar
is done with the assembly plugin, I would like to know whether it makes any
difference to the assembly plugin whether the scope is provided or not.
if not, what is the best way to achieve my goal?
thanks.
S.
Re: question on maven dependency scope
Posted by Greg Chabala <gr...@gmail.com>.
> there will be a common core but i will provide premium
> features as addons. ... what is the best way to achieve my goal?
I would suggest using compile or runtime as the scope, depending on how you
implement the addons, but mark them as optional dependencies.
RE: question on maven dependency scope
Posted by ma...@barclays.com.INVALID.
That sounds like it might actually work
-----Original Message-----
From: Siddharth Jain <si...@gmail.com>
Sent: Sunday, October 1, 2023 8:47 PM
To: Maven Users List <us...@maven.apache.org>
Subject: question on maven dependency scope
CAUTION: This email originated from outside our organisation - siddhsql@gmail.com Do not click on links, open attachments, or respond unless you recognize the sender and can validate the content is safe.
hello.
https://clicktime.symantec.com/15siFB7xf2QcUHAdxCz1m?h=rHBhQF_TXrl6Mj2r5j5v0vCyG83lV5yoa6fcxP1NDwY=&u=https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html%23Dependency_Scope
- *provided*
This is much like compile, but indicates you expect the JDK or a
container to provide the dependency at runtime. For example, when building
a web application for the Java Enterprise Edition, you would set the
dependency on the Servlet API and related Java EE APIs to scope provided because
the web container provides those classes. A dependency with this scope is
added to the classpath used for compilation and test, but not the runtime
classpath. It is not transitive.
what does the runtime classpath mean here? does it mean the classpath when running the application using the maven-exec-plugin? does it make any difference to the maven-assembly-plugin whether scope is provided or not?
context: I am trying to build an application with different levels of subscription. there will be a common core but i will provide premium features as addons. so I want to treat them as dependencies with provided scope in the core and package the application differently depending on the customer's subscription level. as the packing into a jar is done with the assembly plugin, I would like to know whether it makes any difference to the assembly plugin whether the scope is provided or not.
if not, what is the best way to achieve my goal?
thanks.
S.
This message is for information purposes only. It is not a recommendation, advice, offer or solicitation to buy or sell a product or service, nor an official confirmation of any transaction. It is directed at persons who are professionals and is intended for the recipient(s) only. It is not directed at retail customers. This message is subject to the terms at: https://www.cib.barclays/disclosures/web-and-email-disclaimer.html.
For important disclosures, please see: https://www.cib.barclays/disclosures/sales-and-trading-disclaimer.html regarding marketing commentary from Barclays Sales and/or Trading desks, who are active market participants; https://www.cib.barclays/disclosures/barclays-global-markets-disclosures.html regarding our standard terms for Barclays Corporate and Investment Bank where we trade with you in principal-to-principal wholesale markets transactions; and in respect to Barclays Research, including disclosures relating to specific issuers, see: http://publicresearch.barclays.com.
__________________________________________________________________________________
If you are incorporated or operating in Australia, read these important disclosures: https://www.cib.barclays/disclosures/important-disclosures-asia-pacific.html.
__________________________________________________________________________________
For more details about how we use personal information, see our privacy notice: https://www.cib.barclays/disclosures/personal-information-use.html.
__________________________________________________________________________________