gpt4 book ai didi

maven - 我的 Artifact 似乎很大,可以由 Maven 部署。我能做什么?

转载 作者:行者123 更新时间:2023-12-04 14:00:32 25 4
gpt4 key购买 nike

我的 maven 3.0.3 版本有一个 -Xmx1G-XX:MaxPermSize=500M设在 Jenkins 。然而,当我进行部署时,我总是得到

java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
at sun.net.www.http.PosterOutputStream.write(PosterOutputStream.java:61)
at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:492)
at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:457)
at org.apache.maven.wagon.AbstractWagon.putTransfer(AbstractWagon.java:411)
at org.apache.maven.wagon.AbstractWagon.transfer(AbstractWagon.java:392)
at org.apache.maven.wagon.AbstractWagon.putTransfer(AbstractWagon.java:365)
at org.apache.maven.wagon.StreamWagon.put(StreamWagon.java:163)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$PutTask.run(WagonRepositoryConnector.java:825)
at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.put(WagonRepositoryConnector.java:465)
at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:278)
at org.sonatype.aether.impl.internal.DefaultDeployer.deploy(DefaultDeployer.java:215)
at org.sonatype.aether.impl.internal.DefaultRepositorySystem.deploy(DefaultRepositorySystem.java:480)
at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:137)
at org.apache.maven.plugin.deploy.AbstractDeployMojo.deploy(AbstractDeployMojo.java:167)
at org.apache.maven.plugin.deploy.DeployMojo.execute(DeployMojo.java:188)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)

要部署的 Artifact 是 283M大。我该怎么做才能正确部署它?

最佳答案

此问题是由 this bug 引起的.按照链接中的建议,只需使用 webdav 进行部署。

考虑执行以下操作:

<project>
[...]
<build>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-webdav</artifactId>
<version>1.0</version>
</extension>
</extensions>
</plugin>
</build>
...
<distributionManagement>
<site>
<id>sample-project.website</id>
<url>dav:https://dav.sample.com/sites/sample-project</url>
</site>
</distributionManagement>
...
</project>

我以前有过这个问题。我相信它只会发生在大小 >= 256 MB 的 Artifact 上。

切换到webdav部署方式后,还可以减少内存设置。 (如果您只是因为部署期间的内存问题而专门修改了它们)。

关于maven - 我的 Artifact 似乎很大,可以由 Maven 部署。我能做什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13767525/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com