部署微服务的项目步骤
下载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>
通过这种方式,你可以在构建过程中使用属性,并根据具体需求来指定属性的值。请根据你的实际情况进行相应的调整。