[英]maven how to configuration xml file into pom.xml
在cmd上正常運行時,命令為java -jar xxx.jar param1。 我的命令是java -jar n2n-adaptor-cimbr-news-pdf-jar-with-dependencies.jar hostserver.xml
如何在pom.xml上充斥hostserver.xml? 因此,tat無需在cmd上運行param。
<modelVersion>4.0.0</modelVersion>
<groupId>n2n</groupId>
<artifactId>n2n-adaptor-cimbr-news-pdf</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.7</java.version>
<main.class>com.n2n.newsPDF.MainNewsCIMBRHostServer</main.class>
</properties>
<build>
<finalName>${project.artifactId}</finalName>
<pluginManagement>
<plugins>
<!-- We specify the Maven compiler plugin as we need to set it to Java
1.8 -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<!-- Maven Assembly Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<!-- get all project dependencies -->
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<!-- MainClass in mainfest make a executable jar -->
<archive>
<manifest>
<mainClass>${main.class}</mainClass>
</manifest>
</archive>
<suiteXmlFiles>
<suiteXmlFile>${project.build.directory}/resources/hostserver2.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- bind to the packaging phase -->
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<includes>
<include>hostserver2.xml</include>
</includes>
</resource>
</resources>
</build>
我進行配置后,當我運行java -jar n2n-adaptor-cimbr-news-pdf-jar-with-dependencies.jar時,它將無法運行。
請指教。
謝謝沙龍
這是您需要在Java(而非Maven)中解決的問題。 您定義Java Main類的參數。 如果要用資源替換命令行參數,這是一個好去處。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.