2017-04-18 16 views
0

私はMavenを使い始めていますので、other PCで実行するテストプロジェクトを作成しようとしました。他のコンピュータでMavenプロジェクトを実行できません

Compiler Plugin私はプロジェクトを実行しているPCでJava 6しか使用していないため、私のPCでJRE 1.8を使用していますので、私はそれを使うことができると信じています。 。

プロジェクトを実行すると、がメインクラスを見つけることができないというエラーが表示されます。

ところで、私が作ったコンピュータでは、他の場所の瓶でも完璧に動作します。

私のの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> 

私はちょうど私の名前と会社を変更しました。

答えて

0

<archive> <index> <manifest><configuration>に基本設定を使用します。これをコードの下で試してみてください。

 <configuration> 
      <archive> 
       <index>true</index> 
       <manifest> 
         <mainClass>com.company.App</mainClass> 
       </manifest> 
      </archive> 
     </configuration> 
+0

これをシェードプラグインの内側に配置する必要があります。 ???はいの場合、私はすでにあなたのために以前のを置き換えて動作しません。 – programode0

関連する問題