zoukankan      html  css  js  c++  java
  • IntelliJ IDEA 如何引入本地 jar 包

    通过添加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>
  • 相关阅读:
    JVM—Java内存结构
    myeclipse中页面utf-8的设置
    Python-统计txt文件里面的分数
    Python-字符串常用函数
    初识C#扩展方法
    Artwork 18年中南多校第一场A
    HDU2586 How far away ?
    HDU5952 Counting Cliques 暴搜优化
    POJ 2763 Housewife Wind 树链拋分
    HDU 3966 Aragorn's Story 树链拋分
  • 原文地址:https://www.cnblogs.com/hunttown/p/13488486.html
Copyright © 2011-2022 走看看