Maven编译javax.ejb不存在

我在eclipse中创建了一个Maven项目,当我尝试在项目目录mvn clean install中运行时,出现以下错误:

[INFO] Compiling 3 source files to C:\Users\Florin\Documents\Facultate\Master\TM

IS\Anul1\Sem2\ORM\Teme\Lab1_5\shop-interfaces\target\classes

[INFO] -------------------------------------------------------------

[ERROR] COMPILATION ERROR :

[INFO] -------------------------------------------------------------

[ERROR] /C:/Users/Florin/Documents/Facultate/Master/TMIS/Anul1/Sem2/ORM/Teme/Lab

1_5/shop-interfaces/src/main/java/ro/unitbv/IShoppingCart.java:[5,17] package ja

vax.ejb does not exist

[ERROR] /C:/Users/Florin/Documents/Facultate/Master/TMIS/Anul1/Sem2/ORM/Teme/Lab

1_5/shop-interfaces/src/main/java/ro/unitbv/IShoppingCart.java:[7,2] cannot find

symbol

symbol: class Remote

[ERROR] /C:/Users/Florin/Documents/Facultate/Master/TMIS/Anul1/Sem2/ORM/Teme/Lab

1_5/shop-interfaces/src/main/java/ro/unitbv/ProductDao.java:[6,17] package javax

.ejb does not exist

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.

1:compile (default-compile) on project shop-interfaces: Compilation failure: Com

pilation failure:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.

1:compile (default-compile) on project shop-interfaces: Compilation failure: Com

pilation failure:

[ERROR] /C:/Users/Florin/Documents/Facultate/Master/TMIS/Anul1/Sem2/ORM/Teme/Lab

1_5/shop-interfaces/src/main/java/ro/unitbv/IShoppingCart.java:[5,17] package ja

vax.ejb does not exist

...

我检查了软件包javax.ejb是否已下载,并且它存在于.m2文件夹中。

编辑:我的pom文件是:

<?xml version="1.0"?>

<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>ro.unitbv</groupId>

<artifactId>shop-interfaces</artifactId>

<version>1.0.0-SNAPSHOT</version>

<name>shop-interfaces</name>

<dependencies>

<dependency>

<groupId>javax</groupId>

<artifactId>javaee-api</artifactId>

<version>7.0</version>

<scope>povided</scope>

</dependency>

</dependencies>

</project>

回答:

根据你真正需要的,你必须定义依赖javax.ejb未在定义javaee-api

您必须提供例如:

<dependency>

<groupId>javax.ejb</groupId>

<artifactId>javax.ejb-api</artifactId>

<version>3.2</version>

<scope>provided</scope>

</dependency>

以上是 Maven编译javax.ejb不存在 的全部内容, 来源链接: utcz.com/qa/401265.html

回到顶部