配置maven

部署微服务的项目步骤

下载git包后,配置maven设置,加载依赖包后,执行`mvn clean install -Dmaven.test.skip=true`跳过测试安装,

插件

<maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${maven-surefire-plugin.version}</version>
    <configuration>
        <testFailureIgnore>true</testFailureIgnore>
        <skip>true</skip>
        <skipTests>true</skipTests>
    </configuration>
</plugin>   
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
            <id>delete</id>
            <phase>clean</phase>
            <goals>
                <goal>run</goal>
            </goals>
            <configuration>
                <target>
                    <delete>
                        <fileset dir="../../../exe-docker/build/jar">
                            <include name="qar-admin-server.jar"/>
                        </fileset>
                    </delete>
                </target>
            </configuration>
        </execution>
        <execution>
            <id>copy</id>
            <phase>package</phase>
            <goals>
                <goal>run</goal>
            </goals>
            <configuration>
                <target>
                    <copy todir="../../../exe-docker/build/jar">
                        <fileset dir="${project.basedir}/target">
                            <include name="*.jar"/>
                        </fileset>
                    </copy>
                </target>
            </configuration>
        </execution>
    </executions>
</plugin>            

配置maven-surefire-plugin,这是一个用于执行Java JUnit和TestNG测试的Maven插件。
: 这个标签包含了插件的配置参数。
true: 当设置为true时,即使测试失败,Maven也会继续执行后续的构建步骤,而不是立即终止。这可以防止单个测试失败阻止整个构建过程。
true: 这个设置告诉Surefire插件完全跳过所有的测试执行。如果同时设置了和,优先级更高,因此这里的true已经足够让Maven跳过测试。
true: 这个设置同样用于跳过测试执行,但在某些情况下(比如插件的旧版本或特定的用例),它可能比更具体。不过,在这里,由于true已经存在,true是多余的。

命令行

 mvn clean install -pl qar-decode/qar-decode-server -am
 mvn clean install -pl qar-admin/qar-admin-server -am
mvn clean install -Dmaven.test.skip=true

安装maven安装包

修改环境变量

vim ~/.bash_profile

export JMETER_HOME=/Users/yyyyjinying/apache-jmeter-5.4.1
export GOROOT=/usr/local/go
export GOPATH=/Users/yyyyjinying/demo-file/git/backend/go
export GROOVY_HOME=/Users/yyyyjinying/sortware/groovy-4.0.14
export MYSQL_HOME=/user/local/mysql
export TOMCAT_HOME=/Users/yyyyjinying/sortware/apache-tomcat-8.5.79
export GRADLE_HOME=/Users/yyyyjinying/.sdkman/candidates/gradle/8.3
export GRADLE_USER_HOME=/Users/yyyyjinying/.gradle
export MAVEN_HOME=/usr/local/apache-maven-3.6.0

PATH=$PATH:$GOROOT/bin:$GROOVY_HOME/bin:$MYSQL_HOME/bin:$TOMCAT_HOME/bin:$GRADLE_HOME/bin:$GRADLE_USER_HOME:$JMETER_HOME/bin:$MAVEN_HOME/bin

配置本地仓库和配置远程仓库

vim /usr/local/apache-maven-3.6.0/conf/settings.xml

<mirror>
    <id>alimaven</id>
    <name>aliyun maven</name>
    <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
    <mirrorOf>central</mirrorOf>
</mirror>
<localRepository>/Users/yyyyjinying/maven_repository</localRepository>

配置idea

在这里插入图片描述

在 Maven 中,你可以通过 -D 参数

在 Maven 中,你可以通过 -D 参数来指定属性并在构建过程中使用它们。以下是一些在 Maven 中使用属性的示例:

在命令行中指定属性:

mvn clean install -DpropertyName=propertyValue

在 POM 文件中定义属性:
在 pom.xml 文件的 标签内定义属性:

<properties>
    <propertyName>propertyValue</propertyName>
</properties>

在 Maven 插件中使用属性:
在插件配置中使用 ${propertyName} 表示属性的值:

<build>
    <plugins>
        <plugin>
            <groupId>...</groupId>
            <artifactId>...</artifactId>
            <configuration>
                <property>${propertyName}</property>
            </configuration>
        </plugin>
    </plugins>
</build>

通过这种方式,你可以在构建过程中使用属性,并根据具体需求来指定属性的值。请根据你的实际情况进行相应的调整。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值