项目结构
TimeUtil代码
package com.ft.common.util;
import java.text.SimpleDateFormat;
import java.util.Date;
public class TimeUtil {
/**
* 返回当前时间的string型
* @return
*/
public static String nowtime() {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String date=df.format(new Date());
return date;
}
}
pom文件,注意parent,common项目是子module
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ftjava</artifactId>
<groupId>ft</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>common</artifactId>
<packaging>jar</packaging>
</project>
点击install,生成jar文件
生成这么一个文件
接下来开始把仓库放到linux服务器上
进行nginx的配置,创建文件夹/www/ftrepo
将jar包上传到linux服务器的此文件夹下
其他项目下载linux服务器上仓库的common依赖
<parent>
<artifactId>ftjava</artifactId>
<groupId>ft</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>test</artifactId>
<dependencies>
<dependency>
<groupId>ft</groupId>
<artifactId>common</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-websocket</artifactId>
</dependency>
</dependencies>
<repositories>
<repository>
<id>fthaha</id>
<url>http://1.0.0.0:7782</url>//此为你自己服务器配的maven仓库的地址
</repository>
</repositories>
</project>
ok了
扫描二维码关注公众号,回复:
12678924 查看本文章
![](/qrcode.jpg)