mvn tomcat:run的问题

xishanlang2001 2008-11-06 06:42:53
小弟使用maven2.0.9,搭建了一个struts basic项目
使用mvn jetty:run-war能正常的跑起来 ,把war包扔到tomcat6.0.14上也能正常运行.

而使用mvn tomcat:run-war就跑不起来 ,报异常说引用了多个版本的logging.log .
使用这条命令(mvn tomcat:run-war)的时候,发现其使用的是tomcat5.5.15.

请问怎么解决这个问题?
另外,怎么指定让maven用tomcat6运行?

谢谢!
...全文
1388 20 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
xishanlang2001 2008-11-23
  • 打赏
  • 举报
回复
最后也只能如此了,放弃了
mvn tomcat:run-war
的方案.

多谢大家指教!
daihaha 2008-11-12
  • 打赏
  • 举报
回复
直接mvn编译,然后把target下的JAR文件放入tomcat的wabapps文件夹下,启动tomcat运行
xishanlang2001 2008-11-11
  • 打赏
  • 举报
回复
晕...说我回帖太快,有灌水嫌疑,pom.xml没贴完
xishanlang2001 2008-11-11
  • 打赏
  • 举报
回复
查到一点线索.
在maven1中,tomcat版本是在build.properties指定的.到了maven2中,就用setting.xml取代了.

请问在setting.xml里怎么指定以下两个值:

maven.tomcat.home=D:\apache-tomcat-6.0.14
maven.tomcat.version.major=6
daihaha 2008-11-10
  • 打赏
  • 举报
回复
很郁闷,链接sqlserver数据库不能自动生成pojo,还得手动来...
xishanlang2001 2008-11-09
  • 打赏
  • 举报
回复
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<dependentWarExcludes>
**/jdbc.properties,**/hibernate.cfg.xml,**/sql-map-config.xml,**/web.xml,WEB-INF/classes/META-INF/**
</dependentWarExcludes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>native2ascii-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
<configuration>
<dest>target/classes</dest>
<src>src/main/resources</src>
</configuration>
<executions>
<execution>
<id>native2ascii-utf8</id>
<goals>
<goal>native2ascii</goal>
</goals>
<configuration>
<encoding>UTF8</encoding>
<includes>
ApplicationResources_ko.properties,
ApplicationResources_no.properties,
ApplicationResources_tr.properties,
ApplicationResources_zh*.properties
</includes>
</configuration>
</execution>
<execution>
<id>native2ascii-8859_1</id>
<goals>
<goal>native2ascii</goal>
</goals>
<configuration>
<encoding>8859_1</encoding>
<includes>
ApplicationResources_de.properties,
ApplicationResources_fr.properties,
ApplicationResources_nl.properties,
ApplicationResources_pt*.properties
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>ApplicationResources_de.properties</exclude>
<exclude>ApplicationResources_fr.properties</exclude>
<exclude>ApplicationResources_ko.properties</exclude>
<exclude>ApplicationResources_nl.properties</exclude>
<exclude>ApplicationResources_no.properties</exclude>
<exclude>ApplicationResources_pt*.properties</exclude>
<exclude>ApplicationResources_tr.properties</exclude>
<exclude>ApplicationResources_zh*.properties</exclude>
<exclude>applicationContext-resources.xml</exclude>
<exclude>struts.xml</exclude>
</excludes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>applicationContext-resources.xml</include>
<include>struts.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</testResource>
<testResource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
<includes>
<include>**/*.xml</include>
</includes>
</testResource>
</testResources>
<finalName>mycontext</finalName>
</build>

<repositories>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>appfuse</id>
<url>http://static.appfuse.org/repository</url>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>appfuse</id>
<url>http://static.appfuse.org/repository</url>
</pluginRepository>
</pluginRepositories>

<!-- Dependencies calculated by AppFuse when running full-source plugin -->
<!-- Dependencies calculated by AppFuse when running full-source plugin -->
<dependencies>
<dependency>
<groupId>${jdbc.groupId}</groupId>
<artifactId>${jdbc.artifactId}</artifactId>
<version>${jdbc.version}</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>${commons.beanutils.version}</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>${commons.collections.version}</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${commons.dbcp.version}</version>
<exclusions>
<exclusion>
<artifactId>xercesImpl</artifactId>
<groupId>xerces</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${commons.fileupload.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
</exclusion>
</exclusions>
</dependency>
xishanlang2001 2008-11-09
  • 打赏
  • 举报
回复
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<additionalProjectnatures>
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
</additionalProjectnatures>
<additionalBuildcommands>
<buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
</additionalBuildcommands>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<wtpversion>1.5</wtpversion>
</configuration>
</plugin>
<plugin>
<artifactId>maven-idea-plugin</artifactId>
<version>2.1</version>
<configuration>
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<dependenciesAsLibraries>true</dependenciesAsLibraries>
<useFullNames>false</useFullNames>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>hibernate3-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<components>
<component>
<name>hbm2ddl</name>
<implementation>annotationconfiguration</implementation>
<!-- Use 'jpaconfiguration' if you're using JPA. -->
<!--<implementation>jpaconfiguration</implementation>-->
</component>
</components>
<componentProperties>
<drop>true</drop>
<jdk5>true</jdk5>
<propertyfile>target/classes/jdbc.properties</propertyfile>
<skip>${maven.test.skip}</skip>
</componentProperties>
</configuration>
<executions>
<execution>
<phase>process-test-resources</phase>
<goals>
<goal>hbm2ddl</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>${jdbc.groupId}</groupId>
<artifactId>${jdbc.artifactId}</artifactId>
<version>${jdbc.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dbunit-maven-plugin</artifactId>
<version>1.0-beta-1</version>
<configuration>
<dataTypeFactoryName>${dbunit.dataTypeFactoryName}</dataTypeFactoryName>
<driver>${jdbc.driverClassName}</driver>
<username>${jdbc.username}</username>
<password>${jdbc.password}</password>
<url>${jdbc.url}</url>
<src>src/test/resources/sample-data.xml</src>
<type>${dbunit.operation.type}</type>
<schema>${dbunit.schema}</schema>
<skip>${maven.test.skip}</skip>
</configuration>
<executions>
<execution>
<id>test-compile</id>
<phase>test-compile</phase>
<goals>
<goal>operation</goal>
</goals>
</execution>
<execution>
<!-- Runs before integration tests and jetty:run-war -->
<id>test</id>
<phase>test</phase>
<goals>
<goal>operation</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>${jdbc.groupId}</groupId>
<artifactId>${jdbc.artifactId}</artifactId>
<version>${jdbc.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>

<configuration>
<url>http://localhost:2020/manager/html</url>
<server>myserver</server>
<path>/mycontext</path>
</configuration>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.9</version>
<configuration>
<contextPath>/</contextPath>
<scanIntervalSeconds>3</scanIntervalSeconds>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>8082</port>
<maxIdleTime>60000</maxIdleTime>
</connector>
</connectors>
<scanTargets>
<scanTarget>src/main/webapp</scanTarget>
</scanTargets>
<scanTargetPatterns>
<scanTargetPattern>
<directory>src/main/webapp/WEB-INF</directory>
<excludes>
<exclude>**/*.jsp</exclude>
</excludes>
<includes>
<include>**/*.properties</include>
<include>**/*.xml</include>
</includes>
</scanTargetPattern>
</scanTargetPatterns>
</configuration>
</plugin>
xishanlang2001 2008-11-09
  • 打赏
  • 举报
回复
按10楼朋友的办法,还是不行.

下面是小弟的pom.xml文件
--------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.freewzq.Struts2Basic</groupId>
<artifactId>Struts2Basic</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>AppFuse Struts 2 Application</name>
<url>http://www.mycompany.com</url>

<prerequisites>
<maven>2.0.6</maven>
</prerequisites>

<licenses>
<license>
<name></name>
<url></url>
</license>
</licenses>

<scm>
<connection></connection>
<developerConnection></developerConnection>
<url></url>
</scm>

<issueManagement>
<system></system>
<url></url>
</issueManagement>

<developers>
<developer>
<id></id>
<name></name>
<email></email>
<timezone></timezone>
</developer>
</developers>

<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>appfuse-maven-plugin</artifactId>
<version>${appfuse.version}</version>
<configuration>
<genericCore>false</genericCore>
<fullSource>true</fullSource>
</configuration>
<!-- Dependency needed by appfuse:gen-model to connect to database. -->
<!-- See http://issues.appfuse.org/browse/APF-868 to learn more. -->
<dependencies>
<dependency>
<groupId>${jdbc.groupId}</groupId>
<artifactId>${jdbc.artifactId}</artifactId>
<version>${jdbc.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<source>1.5</source>
<verbose>true</verbose>
<complianceLevel>1.5</complianceLevel>
<showWeaveInfo>true</showWeaveInfo>
<aspectLibraries>
<aspectLibrary>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</aspectLibrary>
</aspectLibraries>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.6.0</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.6.0</version>
</dependency>
</dependencies>
</plugin>
daihaha 2008-11-07
  • 打赏
  • 举报
回复
<cargo.container>tomcat5x</cargo.container>
<cargo.container.home>${env.CATALINA_HOME}</cargo.container.home>
<cargo.container.url>http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.14/bin/apache-tomcat-6.0.14.zip</cargo.container.url>
<cargo.host>localhost</cargo.host>
<cargo.port>8081</cargo.port>
<cargo.wait>false</cargo.wait>
我把系统的tomcat配置名称改成CATALINA_HOME,以前我这样改,mvn tomcat:run-war启动没有问题
daihaha 2008-11-07
  • 打赏
  • 举报
回复
我也是这个问题,请问LZ解决没?
xuexihappy_Dtw 2008-11-07
  • 打赏
  • 举报
回复
把配置看看
daihaha 2008-11-07
  • 打赏
  • 举报
回复
我也是这个问题,请问LZ解决没?
daihaha 2008-11-07
  • 打赏
  • 举报
回复
我的也是这个问题,楼主解决没?
xishanlang2001 2008-11-07
  • 打赏
  • 举报
回复
http://jira.codehaus.org/browse/MOJO-594
这篇文章说,在meta-info里添加context.xml,就能解决,具体怎么作呢?
哪位高手请指点一下
liguangwen86 2008-11-07
  • 打赏
  • 举报
回复
up
xishanlang2001 2008-11-07
  • 打赏
  • 举报
回复
UP
xishanlang2001 2008-11-06
  • 打赏
  • 举报
回复
多谢楼上.
设置了.不是exe安装的,是手工下载6.0.14包解压后,指明了环境变量.

奇怪的是,我在pom.xml里,已经配置了以下值:
<cargo.container>tomcat6</cargo.container>
<cargo.container.home>D:\apache-tomcat-6.0.14</cargo.container.home>
<cargo.container.url>http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.14/bin/apache-tomcat-6.0.14.zip</cargo.container.url>
<cargo.host>localhost</cargo.host>
<cargo.port>2020</cargo.port>
<cargo.wait>false</cargo.wait>

但它仍用tomcat5来运行,请大家指点!
victorxiang 2008-11-06
  • 打赏
  • 举报
回复
看看你的环境,设置了TOMCAT_HOME了吗?
还有你的tomcat5.5.15是exe安装版安装的吗?
可以设置tomcat_home来指定运行tomcat

67,549

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧