Maven error: Package matlabcontrol does not exist
Maven error: Package matlabcontrol does not exist
我已将以下 .jars 作为外部 jar 添加到库中。
C:\Users\user\Downloads\common-lang3.jar\common-lang3.jar
C:\Users\user\Downloads\matlabcontrol\matlabcontrol-4.1.0.jar
但是,在 Eclipse 中全新安装 Maven 构建期间,出现以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project com.webapp: Compilation failure: Compilation failure:
[ERROR] /C:/Users/user/workspace/GetTimeDistance/src/com/MatLabClass.java:[4,21] package matlabcontrol does not exist
[ERROR] /C:/Users/user/workspace/GetTimeDistance/src/com/MatLabClass.java:[7,40] package org.apache.commons.lang3.builder does not exist
库中的 jar 源指向正确的 jar。
我可以在我自己的代码中使用罐子里的代码。
当对导入进行 hoovering 时,我得到以下注释:
Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.
有什么想法吗?我已经多次更新了 Maven 项目。
编辑:
我添加了:
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.matlabcontrol</groupId>
<artifactId>matlabcontrol</artifactId>
<version>4.1.0</version>
</dependency>`
到 .pom 文件。这给出了以下警告:
[警告] org.matlabcontrol:matlabcontrol:jar:4.1.0 的 POM 丢失,没有可用的依赖信息。
我假设您使用 eclispe 并将外部 jar 添加到项目属性的 "Build path" 中? "Build path" 被 eclipse IDE 用于在工作区内解析 类,并且在执行 Maven 构建时对使用哪些库没有影响。很可能,您错过了在 pom.xml 文件中将 commons-lang 和 matlabcontrol 定义为依赖项...
当您从 maven 运行 时,所有依赖的 jar 将仅从 maven 存储库中引用。
它不会使用任何外部库或 jar。您在 pom.xml 中定义所需 jar 的 Maven 依赖项。如果你想将本地 jar 复制到你的 Maven 存储库中,下面是 cmd
mvn install:install-file -Dfile=your_local_path_of_jar -DgroupId=your_groupID -DartifactId=your_artifcat_id -Dversion=your_version -Dpackaging=jar
我已将以下 .jars 作为外部 jar 添加到库中。
C:\Users\user\Downloads\common-lang3.jar\common-lang3.jar C:\Users\user\Downloads\matlabcontrol\matlabcontrol-4.1.0.jar
但是,在 Eclipse 中全新安装 Maven 构建期间,出现以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project com.webapp: Compilation failure: Compilation failure:
[ERROR] /C:/Users/user/workspace/GetTimeDistance/src/com/MatLabClass.java:[4,21] package matlabcontrol does not exist
[ERROR] /C:/Users/user/workspace/GetTimeDistance/src/com/MatLabClass.java:[7,40] package org.apache.commons.lang3.builder does not exist
库中的 jar 源指向正确的 jar。 我可以在我自己的代码中使用罐子里的代码。
当对导入进行 hoovering 时,我得到以下注释:
Note: This element neither has attached source nor attached Javadoc and hence no Javadoc could be found.
有什么想法吗?我已经多次更新了 Maven 项目。
编辑: 我添加了:
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.matlabcontrol</groupId>
<artifactId>matlabcontrol</artifactId>
<version>4.1.0</version>
</dependency>`
到 .pom 文件。这给出了以下警告: [警告] org.matlabcontrol:matlabcontrol:jar:4.1.0 的 POM 丢失,没有可用的依赖信息。
我假设您使用 eclispe 并将外部 jar 添加到项目属性的 "Build path" 中? "Build path" 被 eclipse IDE 用于在工作区内解析 类,并且在执行 Maven 构建时对使用哪些库没有影响。很可能,您错过了在 pom.xml 文件中将 commons-lang 和 matlabcontrol 定义为依赖项...
当您从 maven 运行 时,所有依赖的 jar 将仅从 maven 存储库中引用。
它不会使用任何外部库或 jar。您在 pom.xml 中定义所需 jar 的 Maven 依赖项。如果你想将本地 jar 复制到你的 Maven 存储库中,下面是 cmd
mvn install:install-file -Dfile=your_local_path_of_jar -DgroupId=your_groupID -DartifactId=your_artifcat_id -Dversion=your_version -Dpackaging=jar