Maven dependencies provided by wildfly 17 server

1.1k views Asked by At

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.

1

There are 1 answers

3
skomisa On

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.