这个pom文件的正确结构应该是什么。我有一个pom.xml文件,应该适用于Linux和Windows。对于Windows,这个pom文件也应该能够复制zip文件并将其解压缩并将其放入输出文件夹,以便其他项目可以访问它。我实际上不确定我在哪里放置'部分'在pom文件中。实际上不确定我写的结构是否正确。目前,当我尝试在詹金斯建立项目时,它给出了错误。
任何重写pom的帮助都会非常感激!!
`<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>
<groupId>com.Positive.i-trak</groupId>
<artifactId>maven-dependencies</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>i-trak_dependencies</name>
<url>http://www.Positive.com</url>
<!----Profile activation for Linux----->
<profiles>
<profile>
<activation>
<os>
<family>Linux</family>
</os>
</activation>
<repositories>
<repository>
<id>Local Nexus OSS</id>
<url>http://bhi2pkdq4j:8081/nexus/content/repositories/RA_Snapshot</url>
</repository>
</repositories>
<!----Dependency 1----->
<dependencies>
<dependency>
<groupId>com.Positive.i-trak.rpm.snapshot</groupId>
<artifactId>libunifiedautomation</artifactId>
<version>1.5.0_318_3</version>
<type>rpm</type>
</dependency>
<!----Dependency 2---->
<dependency>
<groupId>com.Positive.i-trak.rpm.snapshot</groupId>
<artifactId>libunifiedautomation-devel</artifactId>
<version>1.5.0_318_3</version>
<type>rpm</type>
</dependency>
</dependencies>
</profile>
<!----Profile activation for Windows----->
<profile>
<activation>
<os>
<family>Windows</family>
</os>
</activation>
<groupId>com.Positive.i-trak</groupId>
<artifactId>maven-dependencies</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>i-trak_dependencies</name>
<url>http://www.Positive.com</url>
<repositories>
<repository>
<id>Local Nexus OSS</id>
<url>http://bhi2pkdq4j:8081/nexus/content/repositories/RA_Snapshot</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.Positive.i-trak.Windows.snapshot</groupId>
<artifactId>libunifiedautomation-windows</artifactId>
<type>zip</type>
</dependency>
</dependencies>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack</id>
<phase>validate</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.Positive.i-trak.Windows.snapshot</groupId>
<artifactId>libunifiedautomation-windows</artifactId>
<type>zip</type>
<outputDirectory>%WORKSPACE%/libunifiedautomation-windows/</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</profile>
</project>
目前我得到的错误
[Windows] D:\Jenkins_Workspace\OpcUaFramework_Testbuild>rem 'get the project dependencies'
[Windows]
[Windows] D:\Jenkins_Workspace\OpcUaFramework_Testbuild>mvn dependency:copy-dependencies -f ./pom.xml
[Windows] 'mvn' is not recognized as an internal or external command,
[Windows] operable program or batch file.
[Pipeline] [Windows] }
[Pipeline] [Windows] // stage
[Pipeline] [Windows] echo
[Windows] project build error: hudson.AbortException: script returned exit code 1
[Pipeline] [Windows] }
[Pipeline] [Windows] // ws
[Pipeline] [Windows] }
[Pipeline] [Linux] }
[Pipeline] [Windows] // node
[Pipeline] [Linux] // stage
[Pipeline] [Windows] }
[Windows] Failed in branch Windows
[Linux] [nux_New_OpcUaFramework_test- AQNTYKTM3FNCTUGJ2AXV4AM7UBDXD3OKZZ4IE2AJIOIMORXBPPAQ] Running shell script
[Linux] + mvn dependency:copy-dependencies -f ./pom.xml
[Linux] [INFO] Scanning for projects...
[Linux] [ERROR] The build could not read 1 project -> [Help 1]
[Linux] [ERROR]
[Linux] [ERROR] The project (/var/jenkins-workspace/workspace/nux_New_OpcUaFramework_test-AQNTYKTM3FNCTUGJ2AXV4AM7UBDXD3OKZZ4IE2AJIOIMORXBPPAQ/./pom.xml) has 1 error
[Linux] [ERROR] Non-parseable POM /var/jenkins- workspace/workspace/nux_New_OpcUaFramework_test-AQNTYKTM3FNCTUGJ2AXV4AM7UBDXD3OKZZ4IE2AJIOIMORXBPPAQ/./pom.xml: in comment after two dashes (--) next character must be > not P (position: END_TAG seen ...<url>http://www.bakerhughes.com</url>\n \n <!----P... @11:10) @ line 11, column 10 -> [Help 2]
他就是我在windows中使用maven调用依赖关系的方式
stage('dependencies')
{
bat '''
rem 'get the project dependencies'
mvn dependency:copy-dependencies -f ./pom.xml
'''
}