我没有找到任何tomcat-maven-plugin以外的tomcat 7-maven-plugin。我可以在apache-tomcat-9.0.0.M15中使用它吗?
mqxuamgl1#
您可以使用该插件部署到单独运行的tomcat 9。run目标不会起作用,但deploy目标会。
run
deploy
<plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <url>http://localhost:8080/manager/text</url> <server>TomcatServer</server> <path>/myapp</path> </configuration> </plugin>
Maven目标:
mvn tomcat7:deploy mvn tomcat7:undeploy mvn tomcat7:redeploy
注意:不要忘记在tomcat-users.xml和maven settings.xml中添加tomcat用户tomcat-user.xml
<?xml version='1.0' encoding='utf-8'?> <tomcat-users> <role rolename="manager-gui"/> <role rolename="manager-script"/> <user username="admin" password="password" roles="manager-gui,manager-script" /> </tomcat-users>
manager-scriptrole使应用程序(即maven)能够将jar/war部署到应用服务器。
Maven file settings.xml
<?xml version="1.0" encoding="UTF-8"?> <settings ...> <servers> <server> <id>TomcatServer</id> <username>admin</username> <password>password</password> </server> </servers> </settings>
crcmnpdw2#
正如在其他答案中所述,* tomcat 7-maven-plugin* 仍然可以用于部署到运行的Tomcat 9中,并提供管理器应用程序。但是,要运行embeddedTomcat 9,请尝试Cargo插件:
<plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.7.6</version> <configuration> <container> <containerId>tomcat9x</containerId> <type>embedded</type> </container> </configuration> </plugin>
从以下内容开始:
mvn org.codehaus.cargo:cargo-maven2-plugin:run
t1rydlwq3#
我一直在为同一个问题寻找答案。现在我找到了。
<plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven2-plugin</artifactId> <version>1.8.3</version> <configuration> <container> <containerId>tomcat9x</containerId> <type>embedded</type> </container> <deployables> <deployable> <type>war</type> <location>${project.build.directory}/${project.build.finalName}.war</location> <properties> <context>/</context> </properties> </deployable> </deployables> </configuration> </plugin>
和运行与
mvn package cargo:run
nfzehxib4#
我得到了这个工作与货物maven3插件
<plugin> <groupId>org.codehaus.cargo</groupId> <artifactId>cargo-maven3-plugin</artifactId> <version>1.10.8</version> <configuration> <container> <containerId>tomcat9x</containerId> <type>installed</type> <systemProperties> <property1>value1</property1> </systemProperties> </container> <deployables> <deployable> <artifactId>MYAPP</artifactId> <groupId>com.company</groupId> <type>war</type> <location>${project.build.directory}/${project.build.finalName}.war</location> <pingURL>http://127.0.0.1:8080/APP</pingURL> </deployable> </deployables> <configuration> <type>existing</type> <home>C://DEVTOOLS//apache-tomcat-9.0.36</home> </configuration> </configuration> <executions> <execution> <id>start-server</id> <phase>pre-integration-test</phase> <goals> <goal>start</goal> </goals> </execution> </executions>
4条答案
按热度按时间mqxuamgl1#
您可以使用该插件部署到单独运行的tomcat 9。
run
目标不会起作用,但deploy
目标会。Maven目标:
注意:不要忘记在tomcat-users.xml和maven settings.xml中添加tomcat用户
tomcat-user.xml
manager-scriptrole使应用程序(即maven)能够将jar/war部署到应用服务器。
Maven file settings.xml
crcmnpdw2#
正如在其他答案中所述,* tomcat 7-maven-plugin* 仍然可以用于部署到运行的Tomcat 9中,并提供管理器应用程序。但是,要运行embeddedTomcat 9,请尝试Cargo插件:
从以下内容开始:
t1rydlwq3#
我一直在为同一个问题寻找答案。现在我找到了。
和运行与
nfzehxib4#
我得到了这个工作与货物maven3插件