当我使用maven部署我的战争时,目标战争(完全相同)被上传到服务器两次。有人能解释一下吗?
我在我的模块上使用这个:
clean install org.apache.tomcat.maven:tomcat6-maven-plugin:2.0:redeploy
从日志文件
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ mobile-server ---
[INFO] Packaging webapp
[INFO] Assembling webapp [mobile-server] in [C:\develope\mobile\mobile-server\target\mobile-server]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\develope\mobile\mobile-server\src\main\webapp]
[INFO] Webapp assembled in [241 msecs]
[INFO] Building war: C:\develope\mobile\mobile-server\target\mobile-server.war
[INFO]
[INFO] <<< tomcat6-maven-plugin:2.0:redeploy (default-cli) @ mobile-server <<<
[INFO]
[INFO] --- tomcat6-maven-plugin:2.0:redeploy (default-cli) @ mobile-server ---
[INFO] Deploying war to http://myserver.eu/pra-mobile-server
Uploading: http://myserver.eu/manager-test/deploy?path=%2Fmobile-server&update=true
Uploaded: http://myserver.eu/manager-test/deploy?path=%2Fmobile-server&update=true (12678 KB at 49.3 KB/sec)
Uploading: http://myserver.eu/manager-test/deploy?path=%2Fmobile-server&update=true
Uploaded: http://myserver.eu/manager-test/deploy?path=%2Fmobile-server&update=true (12678 KB at 50.9 KB/sec)
我的主要pom。xml如下所示:
<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>
<parent>
<groupId>eu.company.prj.pramobile</groupId>
<artifactId>mobile-parent</artifactId>
<relativePath>../mobile-parent/pom.xml</relativePath>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>mobile-server</artifactId>
<packaging>war</packaging>
<name>mobile server</name>
<properties>
<version.standard.taglibs>1.1.2</version.standard.taglibs>
</properties>
<repositories>
<repository>
<id>com.springsource.repository.libs-milestone</id>
<name>SpringSource Enterprise Bundle Repository - libs</name>
<url>http://repo.springsource.org/libs-milestone/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mobile-test</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mobile-common</artifactId>
<version>${project.version}</version>
</dependency>
<!-- Import Spring dependencies, these are either from community or versions
certified in WFK2 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-asm</artifactId>
<version>${version.spring}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${version.spring}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${version.spring}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${version.spring}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${version.spring}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${version.spring}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${version.spring}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.springmodules</groupId>
<artifactId>spring-modules-cache</artifactId>
<version>0.8a</version>
<!-- Unfortunately design of spring cache module is not the best - we
need to exclude not necessary dependencies -->
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
<exclusion>
<groupId>gigaspaces</groupId>
<artifactId>gigaspaces-ce</artifactId>
</exclusion>
<exclusion>
<groupId>jini</groupId>
<artifactId>jsk-lib</artifactId>
</exclusion>
<exclusion>
<groupId>jini</groupId>
<artifactId>jsk-platform</artifactId>
</exclusion>
<exclusion>
<groupId>jini</groupId>
<artifactId>mahalo</artifactId>
</exclusion>
<exclusion>
<groupId>jini</groupId>
<artifactId>reggie</artifactId>
</exclusion>
<exclusion>
<groupId>jini</groupId>
<artifactId>start</artifactId>
</exclusion>
<exclusion>
<groupId>jini</groupId>
<artifactId>boot</artifactId>
</exclusion>
<exclusion>
<groupId>jini</groupId>
<artifactId>webster</artifactId>
</exclusion>
<exclusion>
<groupId>commons-attributes</groupId>
<artifactId>commons-attributes-api</artifactId>
</exclusion>
<exclusion>
<groupId>commons-attributes</groupId>
<artifactId>commons-attributes-compiler</artifactId>
</exclusion>
<exclusion>
<groupId>jboss</groupId>
<artifactId>javassist</artifactId>
</exclusion>
<exclusion>
<groupId>jboss</groupId>
<artifactId>jboss-cache</artifactId>
</exclusion>
<exclusion>
<groupId>jboss</groupId>
<artifactId>jboss-common</artifactId>
</exclusion>
<exclusion>
<groupId>jboss</groupId>
<artifactId>jboss-jmx</artifactId>
</exclusion>
<exclusion>
<groupId>jboss</groupId>
<artifactId>jboss-minimal</artifactId>
</exclusion>
<exclusion>
<groupId>jboss</groupId>
<artifactId>jboss-system</artifactId>
</exclusion>
<exclusion>
<groupId>jcs</groupId>
<artifactId>jcs</artifactId>
</exclusion>
<exclusion>
<groupId>jgroups</groupId>
<artifactId>jgroups-all</artifactId>
</exclusion>
<exclusion>
<groupId>geronimo-spec</groupId>
<artifactId>geronimo-spec-jta</artifactId>
</exclusion>
<exclusion>
<groupId>xpp3</groupId>
<artifactId>xpp3_min</artifactId>
</exclusion>
<exclusion>
<groupId>xjavadoc</groupId>
<artifactId>xjavadoc</artifactId>
</exclusion>
<exclusion>
<groupId>opensymphony</groupId>
<artifactId>oscache</artifactId>
</exclusion>
<exclusion>
<groupId>ehcache</groupId>
<artifactId>ehcache</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>${version.quartz}</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4.5</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
<!--mockito for test-->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kubek2k</groupId>
<artifactId>springockito</artifactId>
<version>1.0.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kubek2k</groupId>
<artifactId>springockito-annotations</artifactId>
<version>1.0.5</version>
<scope>test</scope>
</dependency>
<!--testing MVC controllers-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test-mvc</artifactId>
<version>1.0.0.M2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.0.RELEASE</version>
</dependency>
</dependencies>
<build>
<finalName>mobile-server</finalName>
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.10</version>
<configuration>
<jettyEnvXml>${basedir}/src/test/resources/jetty-env.xml</jettyEnvXml>
<!-- Solves locked problem for JSP while jetty is running -->
<webDefaultXml>src/test/resources/webdefault.xml</webDefaultXml>
<stopKey>0</stopKey>
<stopPort>8001</stopPort>
<scanIntervalSeconds>5</scanIntervalSeconds>
<systemProperties>
<systemProperty>
<name>org.apache.commons.logging.Log</name>
<value>org.apache.commons.logging.impl.SimpleLog</value>
</systemProperty>
<systemProperty>
<name>log4j.configurationFile</name>
<value>file:${project.basedir}/src/main/resources/log4j.xml</value>
</systemProperty>
</systemProperties>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
</dependencies>
</plugin>
<!-- Surefire plugin before 2.9 version is buggy -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<configuration>
<parallel>true</parallel>
<threadCount>10</threadCount>
<systemPropertyVariables>
<java.awt.headless>true</java.awt.headless>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<!--to avoid maven error message-->
<configuration>
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
</configuration>
</plugin>
<!--import objects from schema generation-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
<configuration>
<encoding>UTF-8</encoding>
<extension>true</extension>
<packageName>eu.company.prj.pra.mobile.server.generated.place1</packageName>
<schemaDirectory>src/main/resources/META-INF/schema</schemaDirectory>
<outputDirectory>${basedir}/src/main/java/</outputDirectory>
<failOnNoSchemas>true</failOnNoSchemas>
<clearOutputDir>false</clearOutputDir>
</configuration>
</plugin>
<!-- mvn tomcat plugin alternative - run -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.0</version>
<configuration>
<systemProperties>-Dmaven.tomcat.uriEncoding=UTF-8</systemProperties>
<url>${tomcat-maven-plugin.url}</url>
<username>${tomcat-maven-plugin.username}</username>
<password>${tomcat-maven-plugin.password}</password>
</configuration>
</plugin>
<!-- mvn tomcat plugin alternative - run -->
<!--<plugin>-->
<!--<groupId>org.codehaus.mojo</groupId>-->
<!--<artifactId>tomcat-maven-plugin</artifactId>-->
<!--<configuration>-->
<!--<contextFile>${basedir}/src/test/resources/tomcat-context.xml</contextFile>-->
<!--<url>${tomcat-maven-plugin.url}</url>-->
<!--<username>${tomcat-maven-plugin.username}</username>-->
<!--<password>${tomcat-maven-plugin.password}</password>-->
<!--</configuration>-->
<!--<dependencies>-->
<!--<dependency>-->
<!--<groupId>mysql</groupId>-->
<!--<artifactId>mysql-connector-java</artifactId>-->
<!--<version>5.1.9</version>-->
<!--</dependency>-->
<!--</dependencies>-->
<!--</plugin>-->
</plugins>
</build>
更新父pom:
http://maven.apache.org/xsd/maven-4.0.0.xsd"
<groupId>eu.company.prj.mobile</groupId>
<artifactId>mobile-parent</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>mobile project parent</name>
<properties>
<version.spring>3.1.1.RELEASE</version.spring>
<version.jackson>1.9.11</version.jackson>
<version.commons.logging>1.1.1</version.commons.logging>
<version.quartz>2.1.6</version.quartz>
<slf4j.version>1.5.8</slf4j.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<!-- Force Java 6 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
just properties with u/p ...
</profiles>
谢谢你的提示。
最近,我在将我的战争上传到测试服务器时遇到了同样的问题。我做了几次尝试在互联网上找到这个问题的答案,但都没有成功。偶然地,我在我的案例中发现了我们的问题,我在这里分享它,因为也许这可以帮助某人(但是,我不确定这是否是你的案例)。
所以在我的例子中,war的双重上传是由我转发端口的原因引起的。Tomcat通常在8080端口上工作。为了迫使它在80端口上工作,我配置了我的服务器(使用iptable),使它简单地将请求从80转发到8080端口。对于tomcat maven插件配置,我只是使用ip上传,而没有指定8080端口。这导致maven插件上传war两次(第一次请求是重定向,而第二次是实际上传)。
简单地将插件配置中的端口更改为8080就解决了我的问题。
试一试,运行mvn cmd行,但没有安装目标。
react class组件在componentDidMount中调用初始化接口,有些时候会调用两次,通过断点发现顺序是componentDidMount->componentWillUnmount->componentDidMount,但不能稳定复现,调用的组件是页面的主入口,并非某个组件的子组件,请问有知道这个问题的么?
我创建了一个二叉查找树类。我创建了我的插入方法、高度方法和打印方法。当我插入时,一切看起来都很好。如果根为空,我创建一个新的根并设置该项目。但是当我调用我的高度方法时,它打印出2而不是1。当我调用print方法时,它会两次打印出包括root在内的所有元素。例如,我按以下顺序插入了以下元素:9, 5, 4, 55, 555 当我调用PREorderPRINT方法时,它会输出:9, 5, 4, 9,
问题内容: 我试图了解此Python 2.7.5示例脚本的输出: 这产生输出: 2015-08-06 10:13 2015-08-06 10:13 2015-08-06 10:13 170339 170357 170345 170346 171232 170363 2015-08-06 10:13 2015-08-06 10:13 2015-08-06 10:13 我的问题是: A)为什么时间在开
问题内容: 经过一整天的研究和尝试,我终于放弃了 纯AJAX的 上传文件(ps:本文如何与JQuery异步上传文件?埋了我的最后希望) 我的问题可能没什么意义,但是我仍然想知道为什么ajax(或XMLHttpRequest)不能处理这个问题?为什么文件不能像真正的httprequest那样传输? 问题答案: 出于安全原因,JavaScript无法读取本地文件,因此我们无法使用AJAX发送数据。 但
我不知道这是与代码有关还是与服务器有关... 在一个PHP页面上,我调用了一个包含标准PHP上传过程的上传函数。在调用函数之后,我执行重定向(尝试使用window.location或header())。 奇怪的是,每件事都运行良好的几次,然后它就不会再上传了(uploadOK也不会是0)。它不会将文件移动到服务器上。 然后,我将取出重定向,上传将重新开始工作。我把重定向放回去,上传还能工作几次,然
我使用dropwizard制作了一个非常传统的文件上传方法。 所以我在资源中有一个这样的方法 里面没有什么特别的,它只是保存到一个路径,使用java.nio库,就像这样 它只是不会上传excel文件。我在其他地方读到excel文件和它们的底层类型受到怀疑。请问我需要做什么?