Tomcat 7 - Maven插件?

28 maven-2 maven-plugin tomcat7

我只想仔细检查,是否有人发现或正在使用Tomcat 7插件?如果没有,是否有人有兴趣帮我启动并运行?

我想要另一种快速替代Glassfish,JBoss AS 6.0对于快速模型仍然有点沉重.

沃尔特

ray*_*.ng 41

它对我有用,如下所示.

我的setting.xml

 <server>  
   <id>local_tomcat</id>  
   <username>ray</username>  
   <password>password</password>  
 </server>  
Run Code Online (Sandbox Code Playgroud)

我的插件配置

 <plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>tomcat-maven-plugin</artifactId>
  <configuration>
     <server>local_tomcat</server>  
     <url>http://localhost:8080/manager/text</url>  
  </configuration>
 </plugin>
Run Code Online (Sandbox Code Playgroud)

我的tomcat-users.xml

 <role rolename="manager-gui"/>
    <role rolename="manager-script"/>
  <user password="password" roles="manager-gui, manager-script" username="ray"/>
Run Code Online (Sandbox Code Playgroud)

  • 是的,这很有效.我也在努力解决这个问题,但URL配置是我所需要的.似乎认为Tomcat 6是`http:// localhost:8080/manager`,而Tomcat 7是`http:// localhost:8080/manager/text` (6认同)

Mah*_*leh 13

我使用Apache 的官方Tomcat7 Maven插件如下:

            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.0</version>
                <configuration>
                    <path>/${project.artifactId}</path>
                    <port>8080</port>
                </configuration>
            </plugin>
Run Code Online (Sandbox Code Playgroud)

并运行它: mvn tomcat7:run


Pas*_*ent 8

谷歌代码上有t7mp - 一个Tomcat 7 Maven插件.

Cargo(及其Cargo Maven2插件)也支持Tomcat 7(这是CARGO-790).

Apache Tomcat Maven插件2.0-beta-1支持Tomcat 7.


小智 7

使用maven货物,您可以通过以下方式配置您的项目:

<plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>1.0.6</version>
    <configuration>
        <container>
            <containerId>tomcat7x</containerId>
            <type>installed</type>
            <home>${catalina.home}</home>
        </container>
        <configuration>
            <type>existing</type>
            <home>${catalina.home}</home>
        </configuration>
        <deployer>
            <type>installed</type>
            <deployables>
                <deployable>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>${project.artifactId}</artifactId>
                    <type>war</type>
                </deployable>
            </deployables>
        </deployer>
    </configuration>
</plugin>       
Run Code Online (Sandbox Code Playgroud)

不要忘记配置你的catalina.home财产

您可以使用以下方式部署它:

mvn cargo:deploy
Run Code Online (Sandbox Code Playgroud)


tob*_*obr 7

有一个由Tom Tomcat团队开发的Tomcat Maven插件 7插件.

目前,您必须签出源并将其安装到本地存储库.之后你可以在你的pom的插件部分使用它:

      <plugin>
          <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat7-maven-plugin</artifactId>
          <version>2.0-SNAPSHOT</version>
        <executions>
          <execution>
            <id>start-tomcat</id>
            <phase>compile</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
                  <path>/</path>
                  <serverXml>src/main/tomcatconf/server.xml</serverXml>
                </configuration>
          </execution>
        </executions>
      </plugin>
Run Code Online (Sandbox Code Playgroud)


Tor*_*hrn 5

连续三天出现此错误后,这是我的解决方案:

您用于连接的用户至少需要角色管理器脚本.在/conf/tomcat-users.xml中

<role rolename="manager-script"/>
<user username="test" password="test" roles="manager-script"/>
Run Code Online (Sandbox Code Playgroud)

在您的pom.xml中,包含以下插件

    <plugin>
      <groupId>org.apache.tomcat.maven</groupId>
      <artifactId>tomcat7-maven-plugin</artifactId>
      <version>2.0</version>
      <configuration>
        <url>http://server.url:8080/manager/text</url>
        <path>/YourApp</path>
        <username>test</username>
        <password>test</password>
      </configuration>
    </plugin>
Run Code Online (Sandbox Code Playgroud)

与我在互联网上发现的相反,您不需要编辑您的maven setting.xml.tomcat7-maven-plugin可以直接在配置标记中配置

url-tag的一个词:我测试了后缀

  • /经理
  • /经理/ HTML
  • /经理/文

其中只有/经理/文字有效

我的版本:

  • Tomcat:7.0.33
  • Maven:3.0.4
  • tomcat7-maven-plugin:2.0
  • Java:1.7.0_07