温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

idea怎么导入jar包

发布时间:2023-03-27 16:20:30 来源:亿速云 阅读:167 作者:iii 栏目:开发技术

本篇内容主要讲解“idea怎么导入jar包”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“idea怎么导入jar包”吧!

通过添加Libraries的方式引入:

1、首先在根目录下创建一个 libs 的目录

idea怎么导入jar包

2、打开 File -> Project Structure

3、单击 Libraries  -> "+" -> "Java" -> 选择我们导入的项目主目录,点击OK

idea怎么导入jar包

idea怎么导入jar包

4、注意:在弹出的方框中点击“Cancel”,取消将其添加到Module中。

5、libs目录创建成功,删除目录中添加进来的多余内容,重新添加需要的jar包

idea怎么导入jar包

6、重新添加需要的jar包

idea怎么导入jar包

idea怎么导入jar包

idea怎么导入jar包

7、引入jar包:Modules -> 项目 -> “Dependencies”,点击“+” -> “Library”,将刚才创建成功的Library目录加入

idea怎么导入jar包

idea怎么导入jar包

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>

到此,相信大家对“idea怎么导入jar包”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI