Unidbg打Jar包
方式一
以先前WebServer为例子,多模块的例子
配置所有模块,配置启动的Main Class;META-INF选择 Server模块的src目录
文件路径使用相对路径vm = emulator.createDalvikVM(new File("jstz.apk"));
编译工件
将apk放在jar包同目录,运行可得结果
方式二
将Unidbg项目打Jar包后引入
点击ok
在自己的模块中添加jar包依赖(本地依赖该jar包)
<dependency>
<groupId>unidbg</groupId>
<artifactId>unidbg</artifactId>
<version>0.9.7</version>
<scope>system</scope>
<systemPath>/Users/Downloads/unidbg-master_0.97/out/artifacts/unidbg_master_0_97_jar/unidbg-master_0.97.jar</systemPath>
</dependency>
<!-- 如果想关闭log日志打印,需要添加如下 -->
<!--
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
**修改一下spring-boot-starter-web,添加exclusions**
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
-->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>${slf4j.version}</version>
</dependency>
可在项目中创建lib文件夹,目录填写相对路径(${project.basedir}/lib/unidbg-master_0.97.jar
)
使用插件
两种,还未搞明白
xxb
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
<includeSystemScope>true</includeSystemScope>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
可执行jar
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>spring-boot</classifier>
<mainClass>
org.baeldung.executable.ExecutableMavenJar
</mainClass>
</configuration>
</execution>
</executions>
</plugin>
使用命令进行打包
mvn package -T10 -DskipTests
普通项目打Jar包
IDEA方式
同Unidbg方式一,选择指定模块;META-INF选择 Server模块的src目录
Maven方式
<build>
<plugins>
<!-- Jar包与多个依赖包-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<!-- 生成的jar中,不要包含pom.xml和pom.properties这两个文件-->
<addMavenDescriptor>true</addMavenDescriptor>
<manifest>
<!-- 添加一个依赖路径Classpath-->
<addClasspath>true</addClasspath>
<!-- 依赖的是当前目录下的libs/目录(为的是将依赖与主jar区分开)-->
<classpathPrefix>libs/</classpathPrefix>
<!-- 要执行的主Class-->
<mainClass>
org.example.PRequest
</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}/libs
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!-- 依赖包与jar包一起-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<archive>
<manifest>
<mainClass>
org.example.PRequest
</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>