Maven - 对 [javax.activation、javax.annotation] 的未解析引用

发布于 2024-12-29 16:23:55 字数 3488 浏览 1 评论 0原文

我正在使用 OSGI 开发 Web 应用程序。我有一个 Maven 配置错误,我找不到。这是完整的源代码: http://uploading.com/files/8e5c9888/SH_27_test.zip/

这是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>
    <parent>
        <groupId>org.DX_57.osgi.SH_27</groupId>
        <artifactId>SH_27</artifactId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <artifactId>SH_27-impl</artifactId>
    <packaging>bundle</packaging>
    <name>SH_27-impl</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>${pom.groupId}</groupId>
            <artifactId>SH_27-api</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>SH_27-api</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Import-Package>${pom.groupId}.api, org.osgi.framework</Import-Package>
                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                        <Bundle-Activator>${pom.groupId}.impl.SessionHandleApp</Bundle-Activator>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <groupId>org.DX_57.osgi.SH_27</groupId>
</project>

当我尝试使用 Netbeans 编译它时,出现以下错误: http://pastebin.com/whxuSb7V

当我添加@Datasource时出现问题。我似乎在 POM 文件中丢失了一些东西,但我不知道它是什么?

任何帮助将不胜感激。

最好的祝愿 彼得

I'm developing web application with OSGI. I have a maven configuration error which I cannot find. This is the complete source code:
http://uploading.com/files/8e5c9888/SH_27_test.zip/

This is the POM file:

<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>
    <parent>
        <groupId>org.DX_57.osgi.SH_27</groupId>
        <artifactId>SH_27</artifactId>
        <version>1.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <artifactId>SH_27-impl</artifactId>
    <packaging>bundle</packaging>
    <name>SH_27-impl</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.felix</groupId>
            <artifactId>org.osgi.core</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>${pom.groupId}</groupId>
            <artifactId>SH_27-api</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>SH_27-api</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Import-Package>${pom.groupId}.api, org.osgi.framework</Import-Package>
                        <Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
                        <Bundle-Activator>${pom.groupId}.impl.SessionHandleApp</Bundle-Activator>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <groupId>org.DX_57.osgi.SH_27</groupId>
</project>

When I try to compile it with Netbeans I get this error:
http://pastebin.com/whxuSb7V

The problem occurs when I add @Datasource. It seems that I'm missing something in the POM file but I don't have idea what it is?

Any help will be highly appreciated.

Best Wishes
Peter

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

杯别 2025-01-05 16:23:55

查看 Maven:未解析的对 [org.osgi.service.http] 的引用。我认为他也遇到了同样的问题,他通过包含需要导入的特定包来解决这一问题。

Check out Maven: Unresolved references to [org.osgi.service.http]. I think he had the same problem that he managed to resolve by including specific packages that need to be imported.

嘿看小鸭子会跑 2025-01-05 16:23:55

这是解决方案:

 <Import-Package>${pom.groupId}.api, org.osgi.framework</Import-Package> 

应该是:

 <Import-Package>*</Import-Package> 

我希望这对某人有帮助。

This is the solution:

 <Import-Package>${pom.groupId}.api, org.osgi.framework</Import-Package> 

Should be:

 <Import-Package>*</Import-Package> 

I hope that this will be helpful for someone.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文