高洛峰2017-04-18 10:46:06
If you are working on the front-end, you should not change the back-end service code easily. Based on this premise, let’s discuss.
Since it is a maven web project, you can use the maven pacakge
command to package
(you can consult if there is anything that needs special attention when packaging back-end children's shoes)
Copy target/project.war to tomcat’s webapps
Start up tomcat
If there are changes to the backend code, you need to start it all over again
Another way is to add the tomcat plug-in in the pom.xml of the maven project
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>8080</port>
<path>/</path>
<uriEncoding>UTF-8</uriEncoding>
<finalName>${project.artifactId}</finalName>
<server>tomcat</server>
<systemProperties>
<java.net.preferIPv4Stack>true</java.net.preferIPv4Stack>
<!--
<JAVA_OPTS>
-server -Xms1024m -Xmx4096m -XX:PermSize=128M -XX:MaxPermSize=2048 -Dfile.encoding=UTF-8
</JAVA_OPTS>
-->
</systemProperties>
</configuration>
</plugin>
Run mvn tomcat7:run
so you can access the backend service
Consider another situation:
If the backend is the spring-boot project, then you don’t need to do anything, just execute it directly in the project directory mvn spring-boot:run
That’s it
伊谢尔伦2017-04-18 10:46:06
Just make it into a war package and throw it into the tomcatwebAPP directory
伊谢尔伦2017-04-18 10:46:06
There is a bin directory under tomcat, and there is a start or something in it. Copy the project into the webapps folder
黄舟2017-04-18 10:46:06
First of all, if your project does not use an IDE, you need to compile it manually. It is very troublesome to compile the project without an IDE. Tomcat needs to run compiled class files, so you cannot specify an uncompiled project when using tomcat directly. of.