3

I just started using wildfly server version 17 and I got stuck looking into the dependencies that I should mention as provided in my pom file.

I haven't found any thing in the documentation that shows the provided dependencies with their proper versions.

As an example here is what I want:

    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>

I want to know where i get all the dependencies that are provided by the server for future use.

Agricola
  • 572
  • 1
  • 8
  • 20
magran x
  • 91
  • 9

1 Answers1

1

i got stuck about the dependencies that i should mention as provided in my pom file

All you need to include in your pom.xml is the <dependency> shown in your question.

To be clear, you don't usually want or need to "get all the dependencies". All you need is for your code to compile against the Web profile of the EE 7 API, and the <dependency> in your question will achieve that. By specifying <scope>provided</scope> you are explicitly stating that the target runtime, Wildfly 17 in your case, will be providing the required Java EE code, and should not be included in your application's war file.

And if you did include any EE code in your application's war file you might get class loader conflicts on the Wildfly server when your application is loaded.

See The Only One Dependency You Need In Java EE 7 for more information.

I haven't found any things in the documentation that shows the provided dependencies with their proper versions.

The content of the Web profile in EE 7 is formally defined in JSR-000342, and from here you can view or download the document WebProfile.pdf. Page 15 provides the information you want for EE 7 Web profile:

The following technologies are required components of the Web Profile:
• Servlet 3.1
• JavaServer Pages (JSP) 2.3
• Expression Language (EL) 3.0
• Debugging Support for Other Languages (JSR-45) 1.0
• Standard Tag Library for JavaServer Pages (JSTL) 1.2
• JavaServer Faces (JSF) 2.2
• Java API for RESTful Web Services (JAX-RS) 2.0
• Java API for WebSocket (WebSocket) 1.0
• Java API for JSON Processing (JSON-P) 1.0
• Common Annotations for the Java Platform (JSR-250) 1.2
• Enterprise JavaBeans (EJB) 3.2 Lite
• Java Transaction API (JTA) 1.2
• Java Persistence API (JPA) 2.1
• Bean Validation 1.1
• Managed Beans 1.0
• Interceptors 1.2
• Contexts and Dependency Injection for the Java EE Platform 1.1
• Dependency Injection for Java 1.0

I want to know where i get all the dependencies that are provided by the server for future use.

If you want to get the code for some specific component of Java EE:

For example:

  • JSR-000342 and Wikipedia show that EE 7 Web profile uses version 1.1 of Bean Validation.
  • Search on Maven's web site for Bean Validation, and from the list of versions shown ion the Bean Validation API page, click the link to the specific version you want. In your case that would probably be 1.1.0.Final.
  • On the page for Bean Validation API » 1.1.0.Final click the jar link to download the jar file named validation-api-1.1.0.Final.jar. You can also copy the required <dependency> to the clipboard.
skomisa
  • 16,436
  • 7
  • 61
  • 102
  • 2
    Thank you for your response, i know what you mentioned about web profile and what it contains, my question was about what are the dependencies that my wildfly server provide by default so i don't need to add them into my final war, javaee-web-api was just an example that i've used, i want to know from were to get the list of the dependencies that are provided by the server either than javaee-web-api.Thank you very much – magran x Aug 31 '19 at 10:39
  • @magranx OK. In that case I obviously misunderstood what you are asking, and I still don't understand. You might consider rewording your question to clarify exactly what information you are looking for, and why you need it because it is not clear to me at all. – skomisa Aug 31 '19 at 16:06
  • Thank you. what i want to know is how am i supposed to know which dependencies are provided by the environment of wildfly server so i won't include them on the final war file, but instead i will just mention them as provided using provided. – magran x Aug 31 '19 at 18:19