我是Git和Maven的新手。Maven Git仓库
我需要通过Maven购买在git仓库中获取maven项目来构建war文件。
目前我有本地git仓库中的maven项目,我在项目根目录上运行mvn tomcat7:deploy命令来建立并部署它在tomcat服务器上,并且我成功了。
但我想知道如何从远程git存储库获取maven项目并更新本地git存储库并构建war文件。
我现在的pom.xml的是这样的
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.4</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://localhost:8080/manager/text</url> <server>TomcatServer</server> <path>/Test</path> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.4</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>buildnumber-maven-plugin</artifactId> <version>1.2</version> <executions> <execution> <phase>validate</phase> <goals> <goal>create</goal> </goals> </execution> </executions> <configuration> <docheck>true</docheck> <doupdate>true</doupdate> <shortrevisionlength>5</shortrevisionlength> </configuration> </plugin> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.9</version> </dependency> </dependencies> <scm> <connection>scm:git:git://ServerIP/Repository</connection> <developerConnection>scm:git:git://ServerIP/Repository</developerConnection> <url>scm:git:git://ServerIP/Repository</url> </scm>
感谢它帮了我。我从上面理解的是,首先我将运行mvn scm:checkout并拉动存储库,然后运行mvn tomcat7:deploy来构建和部署。或者,如果我只是运行mvn clean install就足够了。 – user3072043
还没有尝试与服务器应用程序,所以我不能确定。 – zlinks
我尝试了mvn scm:checkout命令,但是它向我抛出致命错误:读取错误:无效参数致命:边带解复用器中的错误。但是我能够使用toolkit Git从远程存储库中获取并签出。但通过maven面临上述错误。 – user3072043