maven工具引入lib下的jar文件

1、添加 pom.xml 文件配置includeSystemScope

    <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>

2、添加依赖:

     <!-- 主要的 -->
    <dependency>
        <groupId>cn.com.westone</groupId>
        <artifactId>wcspsdk</artifactId>
        <version>1.0</version>
        <scope>system</scope>
        <systemPath>${project.basedir}/libs/wcspsdk.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;
}

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值