昨天,我读到了glassfish嵌入示例,地址是:http://weblogs.java.net/blog/arungupta/archive/2008/11/totd_56_simple.html
但我运行命令glassfish:run时出现错误消息
No plugin found for prefix 'glassfish' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories我的pom.xml是
<dependencies>
<dependency>
<groupId>org.glassfish.distributions</groupId>
<artifactId>web-all</artifactId>
<version>10.0-SNAPSHOT</version>
<type>jar</type>
<classifier>build</classifier>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.glassfish.embedded</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.0-Prelude-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>utf-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
</plugin>
</plugins>
<finalName>SSH2Maven</finalName>
</build>
<pluginRepositories>
<pluginRepository>
<id>ocean glassfish</id>
<url>http://maven.ocean.net.au/snapshot</url>
<releases>
<enabled>false</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>glassfish repo</id>
<url>http://maven.glassfish.org/content/groups/glassfish</url>
</repository>
</repositories>为什么?请给我一个完整的pom.xml例子,thx。
发布于 2010-06-26 21:30:58
正如我在previous answer中猜测的那样,你正在使用的东西和你正在遵循的教程已经过时了(GlassFish v3 Prelude先于GlassFish v3于2009年12月发布,并在最近的GlassFish 3.0.1版本中进行了更新),从那时起,像Maven这样的东西已经发生了变化。
因此,虽然应该可以让事情正常工作,但我不打算花一些时间来尝试:)相反,这里是maven-embedded-glassfish-plugin的最新(最小)配置
<project>
...
<pluginRepositories>
<pluginRepository>
<id>m.g.o-groups-glassfish</id>
<url>http://maven.glassfish.org/content/groups/glassfish</url>
</pluginRepository>
</pluginRepositories>
...
<build>
<plugins>
<plugin>
<groupId>org.glassfish</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<app>${project.build.directory}/${build.finalName}.war</app>
<autoDelete>true</autoDelete>
<port>8080</port>
<contextRoot>test</contextRoot>
</configuration>
</plugin>
...
</plugins>
...
</build>
</project>然后运行:
mvn embedded-glassfish:run把你的浏览器指向http://localhost:8080/test。
发布于 2013-10-03 06:05:35
以下是运行Embedded GlassFish 4.0的最新版本:
<plugin>
<groupId>org.glassfish.embedded</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>4.0</version>
<configuration>
<app>target/${project.artifactId}.war</app>
<port>8080</port>
<ports>
<https-listener>8181</https-listener>
</ports>
</configuration>
<dependencies>
<dependency>
<groupId>org.glassfish.main.common</groupId>
<artifactId>simple-glassfish-api</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>4.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>start</id>
<phase>integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<execution>
<id>stop</id>
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>请参阅以下网址上的工作示例:
https://stackoverflow.com/questions/3123536
复制相似问题