前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >maven工具引入lib下的jar文件

maven工具引入lib下的jar文件

作者头像
JQ实验室
发布2022-02-10 13:56:36
6560
发布2022-02-10 13:56:36
举报
文章被收录于专栏:实用技术
代码语言:javascript
复制
            <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、添加依赖:

代码语言:javascript
复制
<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添加配置:

代码语言:javascript
复制
    <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读取视频时长:

代码语言:javascript
复制
	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;
	}
本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019-11-25 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档