码迷,mamicode.com
首页 > 其他好文 > 详细

maven配置

时间:2020-02-29 00:32:12      阅读:73      评论:0      收藏:0      [点我收藏+]

标签:base   coding   single   com   无法   depend   hot   odi   end   

1.修改jdk版本

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <java.version>1.8</java.version>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                    <encoding>${project.build.sourceEncoding}</encoding>
                </configuration>
            </plugin>
        </plugins>
    </build>

2.生成可执行jar

    <build>
        <plugins>
            <plugin>
                <artifactId> maven-assembly-plugin </artifactId>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <!-- 入口类 -->
                            <mainClass>com.run.App</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

3.引用本地jar

相对于安装到本地maven的缺点是,打包时无法打入jar

        <dependency>
            <groupId>com.run</groupId>
            <artifactId>MavenPackageChild</artifactId>
            <version>0.0.1-SNAPSHOT</version>
            <scope>system</scope>
            <systemPath>${project.basedir}/lib/MavenPackageChild-0.0.1-SNAPSHOT.jar</systemPath>
        </dependency>

maven配置

标签:base   coding   single   com   无法   depend   hot   odi   end   

原文地址:https://www.cnblogs.com/yinchh/p/12381074.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!