maven仓库失效的情况下搭建maven项目

1,在有maven仓库的情况下mvn clean package
2,整个项目拷贝到没有的环境下
3,ls |xargs -t -I a cp a/pom.xml a/pomback.xml
4,ls |xargs -t -I a vi a/pom.xml 进行所有dependency的删除,vi: 999 dd注意补充</project>
5,ls |xargs -t -I {} mv {}/target/{}-1.0-SNAPSHOT/WEB-INF/lib {}/src/main/webapp/WEB-INF/ # 进行lib目录的移动
6,在idea中打开,设置项目属性,设置modules和artifacts,参考https://blog.csdn.net/fly910905/article/details/78849156
设置artifacts的时候,右侧文件夹可以整个拖过来,然后需要反复拖动几次;不需要设置artifacts;
此时,就可以用idea来进行项目的运行了;
7,在pom中可以增加编译jar包引用,参考https://blog.csdn.net/catoop/article/details/48489365,
使用:
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                    <encoding>UTF-8</encoding>
                    <compilerArgs>
                        <arg>-verbose</arg>
                        <arg>-Xlint:unchecked</arg>
                        <arg>-Xlint:deprecation</arg>
                        <arg>-extdirs</arg>
                        <arg>${project.basedir}/src/main/webapp/WEB-INF/lib</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
        </plugins>
    </build>
这时候可以使用mvn clean package了;

 

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄