<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <executable>true</executable><!-- 直接運行,注冊服務 --> <fork>true</fork> <!-- 如果沒有該配置,devtools不會生效 --> <includeSystemScope>true</includeSystemScope> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin>
1、配置includeSystemScope
2、添加依賴:
<dependency>
<groupId>jave</groupId>
<artifactId>jave</artifactId>
<version>1.0.2</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/jave-1.0.2.jar</systemPath>
</dependency>
3、bulid添加配置:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>${java.version}</source> <target>${java.version}</target> <encoding>${project.build.sourceEncoding}</encoding> <compilerArguments> <!-- 打包本地jar包 --> <extdirs>${project.basedir}/lib</extdirs> </compilerArguments> </configuration> </plugin> </plugins> </build>
4、打包即可;
--------------------------
使用jave.jar讀取視頻時長:
public static String readVideoTime(File source) {
Encoder encoder = new Encoder();
String length = "";
try {
System.out.println("開始解析視頻時長:"+source.getAbsolutePath());
MultimediaInfo m = encoder.getInfo(source);
long ls = m.getDuration() / 1000;
int hour = (int) (ls / 3600);
int minute = (int) (ls % 3600) / 60;
int second = (int) (ls - hour * 3600 - minute * 60);
length = (hour<10?"0":"") + hour + ":" + (minute<10?"0":"") + minute + ":" + (second < 10?"0":"") + second + "";
System.out.println("解析視頻時長結束:"+length);
} catch (Exception e) {
length = "-";
System.err.println(e.getMessage());
}
return length;
}
