gpt4 book ai didi

java - Atmosphere @MeteorService 注释不起作用

转载 作者:行者123 更新时间:2023-12-02 00:17:37 28 4
gpt4 key购买 nike

我尝试从下面的链接创建一个基本的 Atmosphere 测试。我已经从 pom 文件中下载了它要求的所有内容。但由于某种原因, eclipse 无法识别“@MeteorService(path =“/*”,拦截器= {AtmosphereResourceLifecycleInterceptor.class})”

https://github.com/Atmosphere/atmosphere/blob/master/samples/meteor-chat/src/main/java/org/atmosphere/samples/chat/MeteorChat.java

有什么想法吗?我使用的是atmosphere 0.9.7版本

Maven 安装

=======================
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building atmosphere-meteor-chat 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ atmosphere-meteor-chat ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ atmosphere-meteor-chat ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to Q:\myEdu\atmosphere-meteor-chat\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] \myEdu\atmosphere-meteor-chat\src\main\java\org\atmosphere\samples\chat\MeteorChat.java:[31,1] cannot find symbol
symbol: class MeteorService
@MeteorService(path = "/*", interceptors = {AtmosphereResourceLifecycleInterceptor.class})
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.542s
[INFO] Finished at: Tue Jul 24 23:10:57 EDT 2012
[INFO] Final Memory: 7M/121M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project atmosphere-meteor-chat: Compilation failure
[ERROR] \myEdu\atmosphere-meteor-chat\src\main\java\org\atmosphere\samples\chat\MeteorChat.java:[31,1] cannot find symbol
[ERROR] symbol: class MeteorService
[ERROR] @MeteorService(path = "/*", interceptors = {AtmosphereResourceLifecycleInterceptor.class})
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

POM XML

<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.atmosphere.samples</groupId>
<artifactId>atmosphere-meteor-chat</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>atmosphere-meteor-chat</name>
<properties>
<atmosphere.version>0.9.7</atmosphere.version>
<jersey.version>1.10</jersey.version>
<nettosphere.version>1.3.1</nettosphere.version>
<ahc.version>1.7.4</ahc.version>
<javaee.version>6.0</javaee.version>
<testng.version>6.5.2</testng.version>
<logback.version>1.0.6</logback.version>
<maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version>
<maven-war-plugin.version>2.1.1</maven-war-plugin.version>
<jetty.version>8.1.1.v20120215</jetty.version>
</properties>
<repositories>
<repository>
<id>Sonatype snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<repository>
<id>Sonatype releases</id>
<url>https://oss.sonatype.org/content/repositories/releases</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-jquery</artifactId>
<version>${atmosphere.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>org.atmosphere</groupId>
<artifactId>atmosphere-runtime</artifactId>
<version>${atmosphere.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback.version}</version>
</dependency>
<!-- This is ONLY required if you use Atmosphere's annotation -->
<dependency>
<groupId>eu.infomas</groupId>
<artifactId>annotation-detector</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-servlet_3.0_spec</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</project>

最佳答案

MeteorService 的 Atmosphere 运行时版本为 1.1.0-SNAPSHOT,因此将 0.9.7 更改为 1.1.0-SNAPSHOT 应该可以修复该问题。

我还发现 m2e-apt Eclipse 插件可以帮助从 Maven 进行注释稳定更新站点http://download.jboss.org/jbosstools/updates/m2e-extensions/m2e-apt

关于java - Atmosphere @MeteorService 注释不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11623334/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com