intellij idea如何导入jar包(idea如何导入jar包)
导读:通过添加Libraries的方式引入:...
通过添加Libraries的方式引入:
1 、首先在根目录下创建一个 libs 的目录
2 、打开 File -> Project Structure
3、单击 Libraries -> "+" -> "Java" -> 选择我们导入的项目主目录 ,点击OK
4 、注意:在弹出的方框中点击“Cancel ”,取消将其添加到Module中 。
5 、libs目录创建成功 ,删除目录中添加进来的多余内容,重新添加需要的jar包
6 、重新添加需要的jar包
7 、引入jar包:Modules -> 项目 -> “Dependencies ” ,点击“+” -> “Library ” ,将刚才创建成功的Library目录加入
8 、jar包导入成功!
9 、如果要将引入的jar包打包到war中 ,需要在pom文件中添加以下配置+
<!-- 引用本地jar包 --> <dependency> <groupId>com.aspose</groupId> <artifactId>aspose-words</artifactId> <version>16.8.0</version> <scope>system</scope> <systemPath>${pom.basedir}/libs/aspose-words-16.8.0-jdk16.jar</systemPath> </dependency> <dependency> <groupId>com.aspose</groupId> <artifactId>aspose-cells</artifactId> <version>8.5.2</version> <scope>system</scope> <systemPath>${pom.basedir}/libs/aspose-cells-8.5.2.jar</systemPath> </dependency> <dependency> <groupId>com.aspose</groupId> <artifactId>aspose-slides</artifactId> <version>15.9.0</version> <scope>system</scope> <systemPath>${pom.basedir}/libs/aspose.slides-15.9.0.jar</systemPath> </dependency> <!-- 将本地jar包打到war中 --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>copy-dependencies</id> <phase>compile</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/lib</outputDirectory> <includeScope>system</includeScope> </configuration> </execution> </executions> </plugin>创心域SEO版权声明:以上内容作者已申请原创保护,未经允许不得转载,侵权必究!授权事宜、对本内容有异议或投诉,敬请联系网站管理员,我们将尽快回复您,谢谢合作!