Deploy additional jar file with Maven?(是否使用Maven部署其他JAR文件?)
                            本文介绍了是否使用Maven部署其他JAR文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
                        
                        问题描述
我有一个构件,它是以一种特定的方式构建和部署的(不是JAR文件)。在部署过程中,将构建一个WAR文件。
如何配置POM以使项目也作为JAR文件部署到其他位置?
推荐答案
Mavendeploy表示将项目部署到Maven存储库,而不是应用程序服务器。
按如下方式配置其他JAR项目:
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <executions>
        <execution>
            <id>make-a-jar</id>
            <phase>compile</phase>
            <goals>
                <goal>jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>
将此新项目附加到您的项目:
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>1.7</version>
    <executions>
        <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
                <goal>attach-artifact</goal>
            </goals>
            <configuration>
                <artifacts>
                    <artifact>
                        <file>${project.build.directory}/${project.artifactId}-${project.version}.jar</file>
                        <!-- <file>${project.build.directory}/${project.build.finalName}.jar</file> - if finalName is defined -->
                        <type>jar</type>                           
                    </artifact>
                </artifacts>
            </configuration>
        </execution>
    </executions>
</plugin>
                        这篇关于是否使用Maven部署其他JAR文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
				 沃梦达教程
				
			本文标题为:是否使用Maven部署其他JAR文件?
				
        
 
            
        基础教程推荐
             猜你喜欢
        
	     - 大摇大摆的枚举 2022-01-01
 - 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
 - Java Swing计时器未清除 2022-01-01
 - 在 Java 中创建日期的正确方法是什么? 2022-01-01
 - 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
 - 验证是否调用了所有 getter 方法 2022-01-01
 - 从 python 访问 JVM 2022-01-01
 - 不推荐使用 Api 注释的描述 2022-01-01
 - 多个组件的复杂布局 2022-01-01
 - Java 实例变量在两个语句中声明和初始化 2022-01-01
 
    	
    	
    	
    	
    	
    	
    	
    	
						
						
						
						
						
				
				
				
				