How to make the maven pier plugin more accessible for an additional web directory?

I would like to use src / main / javascript as the source directory for my javascript files, at the same time using src / main / webapp for most other web files, but the maven jetty: run plugin does not know about this directory by default.

Below is information on how far I have come so far, but Jetty doesn't seem to know about my javascript directory:

<build> <plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.12</version> <configuration> <webAppConfig> <contextPath>/${project.artifactId}</contextPath> <extraClasspath>target/classes/:src/main/javascript</extraClasspath> </webAppConfig> <webResources> <resource> <directory>src/main/webapp</directory> <directory>src/main/javascript</directory> </resource> </webResources> </configuration> </plugin> 

How do I make the maven pier plugin aware of this additional web directory?

+6
source share
2 answers

Seems like this might help you:

So, I would modify your configuration as follows:

 <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.12</version> <configuration> <webAppConfig> <contextPath>/${project.artifactId}</contextPath> <!-- Javascript files are not java class files, so you can skip this <extraClasspath>target/classes/:src/main/javascript</extraClasspath> --> <baseResource implementation="org.mortbay.resource.ResourceCollection"> <resourcesAsCSV>src/main/webapp,src/main/javascript</resourcesAsCSV> </baseResource> </webAppConfig> </configuration> </plugin> 
+5
source

Note that the ResourceCollection class has moved to the latest version of Jetty (9.3.0.M2).

Therefore, the implementation should point to org.eclipse.jetty.util.resource :

 <plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>9.3.0.M2</version> <configuration> <webAppConfig> <baseResource implementation="org.eclipse.jetty.util.resource.ResourceCollection"> <resourcesAsCSV>src/main/webapp,src/main/javascript</resourcesAsCSV> </baseResource> </webAppConfig> </configuration> </plugin> 
+2
source

Source: https://habr.com/ru/post/912666/


All Articles