【maven】maven项目打包jar 打包源码,mvn命令打包源码

如题:maven项目打包jar 打包源码,mvn命令打包源码

 

需要:

1.pom.xml文件配置如下:核心红色显示

<build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.pluginsgroupId>
                    <artifactId>maven-jar-pluginartifactId>
                    <version>2.1version>
                plugin>
                <plugin>
                    <groupId>org.apache.maven.pluginsgroupId>
                    <artifactId>maven-compiler-pluginartifactId>
                    <version>2.5.1version>
                    <configuration>
                        <source>1.7source>
                        <target>1.7target>
                        <encoding>UTF-8encoding>
                    configuration>
                plugin>
                
                    org.apache.maven.plugins
                    maven-source-plugin
                    
                        
                            attach-sources
                            
                                jar
                            
                        
                    
                
            plugins>
        pluginManagement>
    build>

 

 

2.正常打包命令如下:

mvn clean deploy

 

3.正常打包完,打包源码的命令:

mvn clean source:jar deploy

 

你可能感兴趣的:(【maven】maven项目打包jar 打包源码,mvn命令打包源码)