为了使用tomcat 7管理器(或mvn tomcat:deploy
),我需要在某处放置一个settings.xml文件.
该文件将包含以下内容:
<server>
<id>myserver</id>
<username>myusername</username>
<password>mypassword</password>
</server>
Run Code Online (Sandbox Code Playgroud)
这个文件在哪里?
是否需要在某处明确引用?
我正在使用Maven 3.0.3和Tomcat插件.使用Maven和Tomcat,我想部署一个嵌入的站点实例.我的问题是如何在嵌入式Tomcat服务器中配置其他上下文路径?下面是我的Tomcat配置,但我的""规范无效或该文件的内容(如下)无效......
<Context path="/all-new-jx-web" docBase="/Users/davea/Documents/workspace/NissanUSA2/Technology/nna/mycousa/jx/target/web">
Run Code Online (Sandbox Code Playgroud)
因为当我调用时
mvn clean -Dmaven.test.skip=true verify -Ptomcat tomcat:run
Run Code Online (Sandbox Code Playgroud)
,没有映射到"/ all-new-jx-web"(我的附加上下文路径)的URL被映射(资产不由Tomcat提供).有什么想法吗?下面是我的pom.xml文件中的tomcat配置文件...
<profile>
<id>tomcat</id>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<contextFile>config/tomcat/context.xml</contextFile>
<mode>context</mode>
<addContextWarDependencies>true</addContextWarDependencies>
<charset>UTF-8</charset>
<path>/all-new-jx</path>
<update>true</update>
<warDirectory>target/${project.artifactId}-${project.version}.${project.packaging}</warDirectory>
<systemProperties>
<JAVA_OPTS>-Xms256m -Xmx512m -XX:MaxPermSize=256m -XX:NewRatio=6
-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
-verbose:gc"</JAVA_OPTS>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Run Code Online (Sandbox Code Playgroud)
感谢任何解决方案和其他故障排除步骤, - 戴夫
我使用jenkins来构建我的gwt应用程序,现在我想运行一个tomcat:在该已构建的项目上进行部署,以便它可以将构建的war部署到tomcat.
问题是,即使包刚刚完成,它仍然坚持事先做一个包.
这导致gwt重新编译 - 这需要很长时间.
有没有办法可以使用maven调用部署到tomcat,只需部署已经存在的战争?
我一直在使用tomcat7-maven-plugin.我想运行我的webapp,它使用嵌入式tomcat连接到PostgreSQL数据库.这是我的POM文件的相关部分:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0-SNAPSHOT</version>
<executions>
<execution>
<id>tomcat-run</id>
<goals>
<goal>exec-war-only</goal>
</goals>
<phase>package</phase>
<configuration>
<path>/</path>
<attachArtifactClassifierType>war</attachArtifactClassifierType>
<enableNaming>true</enableNaming>
<extraDependencies>
<extraDependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>8.4-701.jdbc4</version>
</extraDependency>
</extraDependencies>
</configuration>
</execution>
</executions>
Run Code Online (Sandbox Code Playgroud)
执行tomcat7:运行失败
Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:236)
... 29 more
Run Code Online (Sandbox Code Playgroud)
依赖本身是正确的(http://repo1.maven.org/maven2/postgresql/postgresql/8.4-701.jdbc4/).
我使用Maven 3.
我们曾经Tomcat
在IntelliJ中进行运行配置。这将我们的webapp部署到本地安装的tomcat实例,并让我们调试java类和jsp文件。
现在,我们切换到了Maven,现在我们使用带有maven目标的tomcat7 maven插件运行Tomcat实例:tomcat7:run-war
调试我们的java类效果很好,但是(由于大量的遗留代码)我们还需要能够调试JSP文件。
从maven插件启动嵌入式Tomcat时,是否可以在IntelliJ中调试JSP?
我想要两个不同的 web.xml
在我的 Maven 项目中描述符文件。第一个(默认)应该包含在用于部署到应用服务器的 war 文件中,第二个应该用于使用tomcat7-maven-plugin:run
. 我知道有<tomcatWebXml>
参数,但它指定了web.xml
我不想更改的Tomcat 全局变量。
因为jetty-maven-plugin:run
我可以指定<webApp>/<descriptor>
或<webApp>/<overrideDescriptor>
。Firstweb.xml
用指定的文件替换 default ,而 second 除了 default 之外还应用指定的文件内容web.xml
。
有没有可能如何实现相同的功能tomcat7-maven-plugin
?
我正在尝试使用Windows中的命令提示符将战争从本地计算机重新部署到远程Tomcat 7.我能够第一次使用tomcat-maven-plugin上传战争,但后续的上传给我一个类似的消息.
<!-- Deploy to Remote Tomcat -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>${unix.tomcat.url}</url>
<server>sandbox-tomcat</server>
<path>/${project.artifactId}</path>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
mvn tomcat7:redeploy
Run Code Online (Sandbox Code Playgroud)
[INFO] Deploying war to http://secdevapp11.gspt.net:8080/istore-tax-service
Uploading: http://secdevapp11.gspt.net:8080/manager/text/deploy?path=%2Fistore-tax-service&update=true
Uploaded: http://secdevapp11.gspt.net:8080/manager/text/deploy?path=%2Fistore-tax-service&update=true (1334 KB at 512.7 KB/sec)
[INFO] tomcatManager status code:200, ReasonPhrase:OK
[INFO] FAIL - Unable to delete [/nfs/home_04/chandeln/installations/apache-tomcat-7.0.52/webapps/istore-tax-service]. The continued presence of this file may cause problems.
[INFO] FAIL - Application already exists at path /istore-tax-service
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.704s
[INFO] Finished …
Run Code Online (Sandbox Code Playgroud) 我正在使用tomcat7-maven-plugin
2.2从命令行运行webapp(我在Windows 8.1,Java 1.7.0_51和Maven 3.2.1).
这是配置(非常简单,我猜):
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<address>localhost</address>
<port>8080</port>
<path>/</path>
<uriEncoding>UTF-8</uriEncoding>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我运行Maven mvn tomcat7:run
并且它正确启动,服务器启动,webapp加载,我可以与它进行交互.
我运行Maven的命令提示符正忙着显示Tomcat输出(这看起来很好):
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building <project-name-here> 0.3
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:run (default-cli) @ <project-name-here> >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ <project-name-here> ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 25 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile …
Run Code Online (Sandbox Code Playgroud) 这是我的pom.xml
构建配置:
<build>
<finalName>cfwd</finalName>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<url>http://xx.xxx.xxx.xxx:8080/manager/text</url>
<server>cifServer</server>
<path>/cfwd</path>
<addContextWarDependencies>true</addContextWarDependencies>
<addWarDependenciesInClassloader>true</addWarDependenciesInClassloader>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Run Code Online (Sandbox Code Playgroud)
http://xx.xxx.xxx.xxx:8080
远程服务器IP 在哪里.
当我尝试通过mvn tomcat:deploy
我进行部署时出现此错误:
[错误]无法在项目cfwd上执行目标org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy(default-cli):无法调用Tomcat管理器:服务器返回HTTP响应代码:403用于URL:
http://localhost:8080/manager/deploy?path=%2Fcfwd&war=
- > [帮助1] org.apache.maven.lifecycle.LifecycleExecutionException:无法在项目cfwd上执行目标org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy(default-cli):无法调用Tomcat管理器
它看起来像maven试图部署到localhost:8080
而不是远程服务器IP.任何的想法?
我想有tomcat 7 maven插件,并按照[插件网站] [1]的说明进行操作.发生的事情是,它似乎能够找到tomcat 6.0.29,但不是版本7.我知道因为当我尝试tomcat:run时,启动的那个是6.0.29版本.
据我所知,t7的插件仍在开发中,因此是快照版本,我假设我需要为快照插件提供repo,我放置了
<pluginRepository>
<id>tomcat snapshot</id>
<name>tomcat snapshot</name>
<url>http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/</url>
</pluginRepository>
Run Code Online (Sandbox Code Playgroud)
但它似乎与我的tomcat没有任何变化:运行-U(更新快照),仍然运行6.x版本.这是我的mvn tomcat的输出:info -U:
C:\Users\albert\workspace\BasicSetup>mvn tomcat:info -U
[INFO] Scanning for projects...
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/org/apache
/tomcat/maven/tomcat7-maven-plugin/2.0-SNAPSHOT/maven-metadata.xml
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/org/apache
/tomcat/maven/tomcat7-maven-plugin/2.0-SNAPSHOT/maven-metadata.xml
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/org/apache
/tomcat/maven/tomcat7-maven-plugin/2.0-SNAPSHOT/tomcat7-maven-plugin-2.0-SNAPSHOT.pom
[WARNING] The POM for org.apache.tomcat.maven:tomcat7-maven-plugin:jar:2.0-SNAPSHOT is missing, no d
ependency information available
[WARNING] Failed to retrieve plugin descriptor for org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-
SNAPSHOT: Plugin org.apache.tomcat.maven:tomcat7-maven-plugin:2.0-SNAPSHOT or one of its dependencie
s could not be resolved: Failed to read artifact descriptor for org.apache.tomcat.maven:tomcat7-mave
n-plugin:jar:2.0-SNAPSHOT
Downloading: http://repo1.maven.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading: http://repo1.maven.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloading: http://people.apache.org/repo/m2-snapshot-repository/org/apache/tomcat/maven/org/codeha
us/mojo/maven-metadata.xml …
Run Code Online (Sandbox Code Playgroud)