經過添加Libraries的方式引入:apache
一、首先在根目錄下建立一個 libs 的目錄maven
二、打開 File -> Project Structureide
三、單擊 Libraries -> "+" -> "Java" -> 選擇咱們導入的項目主目錄,點擊OKui
四、注意:在彈出的方框中點擊「Cancel」,取消將其添加到Module中。code
五、libs目錄建立成功,刪除目錄中添加進來的多餘內容,從新添加須要的jar包blog
六、從新添加須要的jar包ci
七、引入jar包:Modules -> 項目 -> 「Dependencies」,點擊「+」 -> 「Library」,將剛纔建立成功的Library目錄加入io
八、jar包導入成功!class
九、若是要將引入的jar包打包到war中,須要在pom文件中添加如下配置+jdk
<!-- 引用本地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>