使用 Gradle 构建可以这样导入整个编译依赖dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) // 像是这样 compile('io.socket:socket.io-client:0.7.0') { exclude group: 'org.json', module: 'json' } compile 'com.android.support:appcompat-v7:23.2.0' compile 'com.android.support:recyclerview-v7:23.2.0' compile 'com.android.support:design:23.2.0' compile 'com.google.android.gms:play-services-appindexing:8.1.0' testCompile 'junit:junit:4.12'}但是找遍了 Maven 的插件,只有添加单个 jar <dependencies> <dependency> <groupId>org.x</groupId> <artifactId>my-jar</artifactId> <version>1.0</version> <scope>system</scope> <systemPath>${project.basedir}/lib/x.jar</systemPath> </dependency> </dependencies>另外使用添加 classpath 的方法也没用,编译的时候还是出错<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> <additionalClasspathElements> <classpathElement>${project.basedir}/src/main/webapp/WEB-INF/lib</classpathElement> </additionalClasspathElements> </configuration> </plugin>项目原本是 eclipse dynam web project
2 回答
慕标5832272
TA贡献1966条经验 获得超4个赞
添加单个Jar依赖
<dependency>
<groupId>alipay</groupId>
<artifactId>alipay</artifactId>
<version>4.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/alipay-sdk-java.jar</systemPath>
</dependency>
${basedir}为项目根目录
添加回答
举报
0/150
提交
取消