Mr_and_Mrs_D
Mr_and_Mrs_D

Reputation: 34056

Eclipse maven jboss project - what do I need to add to the pom.xml so maven can compile?

I managed to set up my Jboss WTP project in maven. Right click on the project > Run as > Run on server (Jboss 7) works fine. But if I go ahead and delete the target directory and then try to execute compile goal it fails with missing dependencies:

[INFO] Scanning for projects...
[INFO] 
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.\
singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building PROJECT 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ PROJECT ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\path\\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ PROJECT ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to C:\path\\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /C:/path/to/file/Controller.java:[14,21] package javax.servlet does not exist
#..... NOTICE THIS COMES FROM A CUSTOM JAR
[ERROR] /C:/path/to/file/DataServlet.java:[3,30] package gr.uoa.di.java.helpers does not exist
#.....
[ERROR] /C:/path/to/file/DataServlet.java:[26,32] package javax.servlet.annotation does not exist
[ERROR] /C:/path/to/file/DataServlet.java:[28,26] package javax.servlet.http does not exist
#.....
[INFO] 49 errors 
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------

If I clean the project so the target directory is populated with classes then try to compile the project all fine:

[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ DataCollectionServlet ---
[INFO] Nothing to compile - all classes are up to date

I have 1 question:

I am on Eclipse Luna Java EE pack, maven 3.1 (the one that comes with eclipse) and using Jboss 7.1.1.Final

Upvotes: 2

Views: 470

Answers (1)

Mr_and_Mrs_D
Mr_and_Mrs_D

Reputation: 34056

I ended up just adding:

<dependency>
    <groupId>org.glassfish.web</groupId>
    <artifactId>javax.servlet.jsp.jstl</artifactId>
    <version>1.2.1</version>
    <scope>provided</scope>
</dependency>

This transitively added the servlet-api:

enter image description here

Still don't know if adding this is the right way to add jstl 1.2.1 - notice it adds the jstl 1.2 api (EDIT: it isn't: Standard way of adding JSLT 1.2.1 in a Maven Project?)

I also still have problems with my homebrew jar (Can maven treat WEB-INF\lib the way eclipse (and m2e) does?) but closing this for now.

Upvotes: 1

Related Questions