Win a copy of Rust Web Development this week in the Other Languages forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

compile servlet with Maven 2

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am starting to learn maven but i cannot figure out how to compile a servlet. i created the project with this:



i created a simple index.jsp and a servlet inside testapp/src/main/resources/org/whatever/TestServlet.java

i added the plugin for jetty in my pom.xml and run


the only thing here is that TestServlet.java is being brought to the .war file instead of compiling it to a .class file. how do i make it compile the servlets?
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"resources" is the directory for property files, XML, etc. that need to be on the classpath, but do not need to be compiled. Move your package structure to - testapp/src/main/java/org/whatever/TestServlet.java and it will compile to classes and package them correctly in the WAR.
reply
    Bookmark Topic Watch Topic
  • New Topic