1

Im trying to debug an all together java app with angularJS using maven and jetty but failing to get dynamically generated app.js and app.css files.

On the java app I have:

  Collection<Resource> javaScriptResources = new ArrayList<Resource>();
    javaScriptResources.add(new WebApplicationResource(getServletContext(), "/guacamole.js"));

  Collection<Resource> cssResources = new ArrayList<Resource>();
    cssResources.add(new WebApplicationResource(getServletContext(), "/guacamole.css"));

  serve("/app.js").with(new ResourceServlet(new SequenceResource(javaScriptResources)));
  serve("/app.css").with(new ResourceServlet(new SequenceResource(cssResources)));

These two files are generated by the minify-maven-plugin and the location is <webappSourceDir>${project.build.directory}/${project.build.finalName}</webappSourceDir>, it works great when I run the package maven command and generate the .war file and put in the webapps tomcat folder.

But when I try to debug with IntelliJ using the jetty plugin i get a NullPointerException.I think its because the guacamole.js and the guacamole.css files are in the maven target folder, and the java app tries to find it inside the webapp path. How to fix that?

here are the files but only in the target folder.

gog
  • 11,788
  • 23
  • 67
  • 129

0 Answers0