Jenkins插件构建错误

Fra*_*oth 4 jenkins

我不想使用名称Deploy Plugin修改Jenkins -Plugin .如果我maven安装插件,InjectedTest会遇到FileSystemException:

C:\ Users\froth\AppData\Local\Temp\hudson2805772493654455072test\secret.key:Der Prozess kann nicht auf die Datei zugreifen,da sie von einem anderen Prozess verwendet wird.

用英语讲:

C:\ Users\froth\AppData\Local\Temp\hudson2805772493654455072test\secret.key:进程无法访问该文件,因为它正由另一个进程使用.

我认为这只是VM或Windows7的读/写问题.有谁知道如何解决这个问题?

PS:这是StackTrace:


 T E S T S
-------------------------------------------------------
Running hudson.plugins.deploy.glassfish.GlassFish2xAdapterTest
Running hudson.plugins.deploy.glassfish.GlassFish3xAdapterTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.229 sec - in hudson.plugins.deploy.glassfish.GlassFish2xAdapterTest
Running hudson.plugins.deploy.glassfish.GlassFishAdapterTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.012 sec - in hudson.plugins.deploy.glassfish.GlassFishAdapterTest
Running hudson.plugins.deploy.PasswordProtectedAdapterCargoTest
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.251 sec - in hudson.plugins.deploy.glassfish.GlassFish3xAdapterTest
Running hudson.plugins.deploy.tomcat.Tomcat7xAdapterTest
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.004 sec - in hudson.plugins.deploy.tomcat.Tomcat7xAdapterTest
Running InjectedTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.251 sec - in hudson.plugins.deploy.PasswordProtectedAdapterCargoTest
Tests run: 8, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 12.069 sec <<< FAILURE! - in InjectedTest
org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyTestSuite(org.jvnet.hudson.test.junit.FailedTest)  Time elapsed: 0.005 sec  <<< ERROR!
java.io.IOException: Failed to clean up temp dirs
    at org.jvnet.hudson.test.TemporaryDirectoryAllocator.dispose(TemporaryDirectoryAllocator.java:86)
    at org.jvnet.hudson.test.TestEnvironment.dispose(TestEnvironment.java:81)
    at org.jvnet.hudson.test.HudsonTestCase.tearDown(HudsonTestCase.java:414)
    at org.jvnet.hudson.test.JellyTestSuiteBuilder$JellyTestSuite.tearDown(JellyTestSuiteBuilder.java:138)
    at org.jvnet.hudson.test.junit.GroupedTest.run(GroupedTest.java:53)
    at junit.framework.TestSuite.runTest(TestSuite.java:255)
    at junit.framework.TestSuite.run(TestSuite.java:250)
    at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
    at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
    at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
    at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
Caused by: java.nio.file.FileSystemException: C:\Users\froth\AppData\Local\Temp\hudson2805772493654455072test\secret.key: Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird.
Run Code Online (Sandbox Code Playgroud)

小智 5

我在Windows 7上遇到了同样的问题,并为此进行了一些进一步的分析,打开了https://issues.jenkins-ci.org/browse/JENKINS-21977.

但是,作为临时解决方法,您可以通过将以下内容添加到pom.xml来禁用注入的测试:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <excludes>
                    <exclude>InjectedTest.java</exclude>
                </excludes>
            </configuration>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)