I am developing a web application consisting of the following structure:
enter image description here
When i execute mvn clean package, there is no file in webapp packaged into the jar.
If you are using jar as the packaging structure , put all your static resources under src/main/resources/static and it will automatically get copied into the final jar when you use the command mvn clean install. The webapp folder structure is suitable for war deployment. When the packaging is war , maven will look for the webapp folder and copy it's contents to the resulting war package.
Related
I have created a spring boot project (maven, spring, angular, ...).
Now I have built a JAR file (mvn clean package), and i can execute it - all looks fine. But I can not see my web page. Just an error {"timestamp":1478852927238,"status":404,"error":"Not Found","message":"No message available","path":"/"}
But now, if i add the src folder (contains webapp, java, etc) in the same directory as my JAR file, all works fine. But I want my JAR file to be a standalone application without a src Folder. I have not worked so long with java, so i dont have any idea, what to do.
The packaging of pom.xml is war but I need the compiled webapp folder (with html/css/js/jsp, resources, classes and lib) only, because I will do some modification and package this folder programmatically and packaging this folder into war by maven waste time.
Can I skip generating war file by mvn clean package?
if you want skip generating war file you can use war:exploded plugin
after that, you can run mvn clean compile war:exploded
I want to know how can i remove the target folder and war file which created within webapps folder when i deploy the project.
I'm using eclipse IDE for the deploy project. I want to what is the maven plugin for this goal.
But if I used terminal for deploy the project i can used. But sometimes this command also unable to clean the webapps folder.
mvn clean compile war:war
Do you get an error message when using mvn clean ?
Do you have open files which are located in the structure under target? This prevents the target folder from being deleted.
I have a war project. A few static HTMLs need to be copied into the webapp folder before building war. To achieve this, added maven-resources-plugin copy-resources goal (process-resources phase). This is working fine as I can see the built war includes the copied files.
When I run this war using mvn tomcat7:run the path is not recognised (404).
However, when I deploy the war into a tomcat server, the path is accessible.
Any thoughts? Looks like tomcat7 plugin does not use the built war but accesses the files directly from src folder. Is this a bug or just how tomcat7 plugin works?
Have you tried using the additionalClasspathDirs param? from https://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/run-mojo.html
additionalClasspathDirs:
Additional optional directories to add to the embedded tomcat classpath.
Type: java.util.List
Since: 2.0
Required: No
if that doesn't work you can use maven-antrun-plugin see how to copy a file to tomcat webapp folder using maven?
I'm trying to put a directory called .ebextensions in the root of my WAR using maven. I need this directory to be in the top level directory of my war, in the same place where my META-INF directory is.
I've tried putting .ebextensions in my /src/main/resources directory, and then compiled using mvn install, but this directory is not put in the war.
Am I doing anything wrong?
The project is using google web toolkit, if that makes any difference, but its a normal maven project in every sense (uses a .pom file, requires mvn clean install for compiling, etc).
You can put it in the root by putting it in "src/main/webapp"