maven工具引入lib下的jar文件


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

  


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM