0
我開始使用Maven,因此我嘗試創建一個測試項目以在其他PC中執行它。無法在其他計算機上執行Maven項目
我正在使用Shade Plugin,因爲我只想要一個文件來執行而Compiler Plugin,因爲在我執行該項目的PC中只有Java 6並且在我的PC中使用了JRE 1.8,我相信我可以使用它。
所以問題是,當我執行該項目給我一個錯誤,無法找到主類。
順便說一下,在我創建該項目的計算機上,即使在其他位置使用該jar也可以工作。
這是我的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.company</groupId>
<artifactId>Prueba</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Prueba</name>
<url>http://maven.apache.org</url>
<developers>
<developer>
<name>Me</name>
<organization>Company</organization>
<organizationUrl>https://www.company.moon</organizationUrl>
</developer>
</developers>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.company.App</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
我剛換了我的名字和公司。
我必須把這個裏面的陰影插件,, ???如果是的話,我已經替換了之前的,並且不起作用。 –
programode0