gpt4 book ai didi

git - Maven Git 存储库

转载 作者:行者123 更新时间:2023-11-28 22:02:55 24 4
gpt4 key购买 nike

我是 Git 和 Maven 的新手。

我需要通过 maven buy 获取 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 clean install 时,您希望所有事情都由 maven 一步完成。也就是说,不仅有 maven 来构建和部署您的代码,而且还有它从 git 中 pull 最新版本的代码,然后构建、部署。

如果是这种情况,请查看此处:How can I do a git pull in Maven?

关于git - Maven Git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22222521/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com