如何让STS或Maven停止在项目目录中生成JAR文件?

huangapple go评论63阅读模式
英文:

How to make STS or Maven stop generating JAR in project directory?

问题

这是关于 <build></build> 部分的 pom.xml 代码:

<build>
    <finalName>Fleaty</finalName>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

每次我执行 "Run As -> Spring Boot application",都会在项目目录中生成一些 JAR 文件。如何阻止 STS 或者 Maven 生成 JAR 文件呢?

我不能将它加入到 gitignore 中。如何让STS或Maven停止在项目目录中生成JAR文件?

英文:

I have this code in pom.xml regarding &lt;build&gt;&lt;/build&gt;

&lt;build&gt;
	&lt;finalName&gt;Fleaty&lt;/finalName&gt;
	&lt;plugins&gt;
		&lt;plugin&gt;
			&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
			&lt;artifactId&gt;spring-boot-maven-plugin&lt;/artifactId&gt;
		&lt;/plugin&gt;
	&lt;/plugins&gt;
&lt;/build&gt;

Every time I go Run As -> Spring Boot application, I get some jar file in project directory. How to not make STS or Maven generate jar file?

I cannot gitignore it.如何让STS或Maven停止在项目目录中生成JAR文件?

答案1

得分: 2

你的启动配置可能勾选了生成临时 JAR 选项,以避免类路径过长的问题 - 在启动配置的“Classpath”选项卡中。

根据类路径上的JAR文件数量,启动应用程序的命令可能会变得非常长,这可能会在Windows上由于命令行长度的一些限制而引起问题(该命令行用于执行运行应用程序的操作)。为了解决这个限制,IDE会生成一个临时的JAR文件,并从那里运行应用程序。但是你可以在启动配置中禁用这个选项。

英文:

Your launch config has probably the option checked to generate a temporary JAR to avoid classpath length issues - in the launch config on the Classpath tab.

Depending on the number of JAR files on your classpath, the command to launch your app might get very very long and might cause trouble with some limitations on Windows for the length of the command line (that is being executed to run your app). To workaround this limitation, the IDE generates a temporary JAR and runs the app from there. But you can disable that in the launch config.

huangapple
  • 本文由 发表于 2020年10月23日 21:17:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/64500783.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定