Maven 用到的技巧

1  依赖本地Jar  最好放到目录lib 下面

<dependency>
			<groupId>com.yonyou.dataworks</groupId>
			<artifactId>connection</artifactId>
			<scope>system</scope>
			<version>1.0.0-SNAPSHOT</version>
			<systemPath>${basedir}\src\lib\connection-1.0.0-SNAPSHOT.jar</systemPath>
		</dependency>



2  将所依赖的Jar 全部打包进去,别人用的时候只要依赖一个Jar 就可以搞定

<plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass></mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>


展开阅读全文

没有更多推荐了,返回首页