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.
Related
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.
I have written a REST-API using JAX-RS. For that I have created a Dynamic Web Project in Eclipse, and than converted it into a Maven project.
I want my logger folder to be WEB-INF/logs/loggerFile.out.
So I created a folder in my WebContent/WEB-INF/logs.
But now when I am packaging it in a WAR, the logs folder is missing in the packages WAR as as in the target/MyProj/WEB-INF..there is no log folder there as well.
I tried creating the folder inside target/MyProj/WEB-INF manually, but still its not available in the WAR file.
(I am viewing the content inside the WAR file using 7-zip).
I am doing all this on my Windows-7.
Please help
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"
I have a java web application name webapp,when I export it to a war,the source codes will be compiled to the WEB-INF/classes.
Now I want these classed be compressed to a jar,and put into the WEB-INF/lib.
I have tried this:
create a new java project named webapp_jar.
Copy all the source codes under the webapp/src to the webapp_jar/src,configurate the build path to make the project work.
Add the webapp_jar reference to webapp project.
However ,when I run the webapp,it seems that the classes defined at webapp_jar can not be found.
Is this possible?
BTW,I use the eclipse ee ide.
have you try ant https://ant.apache.org/ ?
you could make a jar and copy it to folder you want and build the war after.
But , if I anderstand, you would package all the app to a jar ?
I think your webapp can't work without a servlet or two ...
This is really easy to do with maven by creating two subject projects, one to build the war, and the other as a jar project and then use the jar project as a dependency on your war project which would put the jar inside the lib directory when packaging the war.
No I use the Web Deployment Assembly settings in eclipse. I worked.
You can find details here.