9

私の人生のためにMaven Glassfishプラグインを機能させることができないようです:

<project>
  ...
  <pluginRepositories>
    <pluginRepository>
      <id>glassfish-repository</id>
      <name>Java.net Repository for Glassfish</name>
      <url>http://download.java.net/maven/glassfish</url>
      <layout>default</layout>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>never</updatePolicy>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.glassfish</groupId>
        <artifactId>maven-embedded-glassfish-plugin</artifactId>
        <version>3.0</version>

        <configuration>
          <goalPrefix>glassfish</goalPrefix>
          <app>${artifactId}.war</app>
          <contextRoot>${context.root}</contextRoot>
          <port>${http.port}</port>
        </configuration>
      </plugin>
      ...
    </plugins>
  </build>  
</project>

を実行するmvn glassfish:runと、別のプラグインを探していて見つかりません:

[INFO] The plugin 'org.apache.maven.plugins:maven-glassfish-plugin' does not exist or no valid version could be found

何か案は?

4

4 に答える 4

14

適切なプラグインを呼び出していません。そのはず:

mvn embedded-glassfish:run

実際、私は次のように使用しています:(宣言した同じプラグインリポジトリを使用):

<plugins>
  <plugin>
    <groupId>org.glassfish</groupId>
    <artifactId>maven-embedded-glassfish-plugin</artifactId>
    <version>3.0</version>
    <configuration>
      <goalPrefix>glassfish</goalPrefix>
      <app>target/test.war</app>
      <port>8080</port>
      <contextRoot>test</contextRoot>
    </configuration>
    <executions>
      <execution>
        <phase>package</phase>
        <goals>
         <goal>run</goal>
        </goals>
      </execution>
    </executions>
  </plugin>
</plugins>

更新:念のため、このプラグインの完全修飾名は次のようになります。

mvn org.glassfish:maven-embedded-glassfish-plugin:3.0:run

しかし、短い名前を使用するとうまくいきます。

于 2010-02-10T17:55:08.353 に答える
3

@Walter White (あなたのコメントに返信する方法がわからない/わからないので、代わりに回答します): 散在する WAR が組み込みの GlassFish v3 で完全にサポートされていないことを読みました。

個人的には、Timer と MessageDriven をサポートする v3.1 が待ち遠しいです。うまくいけば、Web サービスのサポートも含まれます。v3.1 の ETA について手がかりを持っている人はいますか?

PS:mvn org.glassfish:maven-embedded-glassfish-plugin:3.0:run 私のために働きます。今すぐ適切な Maven 統合テスト ライフ サイクルに接続します。

于 2010-04-16T12:07:44.513 に答える
0

この問題は、2 つの異なる maven-glassfish プラグインが同じ名前で存在するという事実から生じます。使ってみて

mvn org.glassfish:maven-glassfish-plugin:run

この問題の詳細な説明は、こちらにあります

于 2010-02-10T17:49:02.817 に答える
0

githubの作業例を参照してください

mvn パッケージ embedded-glassfish:run

<dependencies>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>7.0</version>
    </dependency>
</dependencies>

<build>
    <plugins>

        <plugin>
            <groupId>org.glassfish.embedded</groupId>
            <artifactId>maven-embedded-glassfish-plugin</artifactId>
            <version>3.1.2.2</version>
            <configuration>
                <app>target/${project.artifactId}-${project.version}</app>
                <port>8080</port>
                <contextRoot>${project.artifactId}</contextRoot>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.glassfish.main</groupId>
                    <artifactId>simple-glassfish-api</artifactId>
                    <version>4.0-b79</version>
                </dependency>
                <dependency>
                    <groupId>org.glassfish.main.extras</groupId>
                    <artifactId>glassfish-embedded-all</artifactId>
                    <version>4.0-b83</version>
                </dependency>
            </dependencies>
        </plugin>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
    </plugins>

</build>
<pluginRepositories>
    <pluginRepository>
        <id>maven.java.net</id>
        <name>Java.net Repository for Maven</name>
        <url>https://maven.java.net/content/groups/promoted/</url>
    </pluginRepository>
    <pluginRepository>
        <id>maven2-repository.dev.java.net</id>
        <name>Java.net Repository for Maven</name>
        <url>http://download.java.net/maven/glassfish/</url>
    </pluginRepository>
</pluginRepositories>
于 2014-10-13T05:32:04.257 に答える