Arquillian Error: ArchiveExportException

I ran into a baffling error the other day while working with Arquillian. I added Arquillian to a simple project requiring only the Java SE container for some “lite” CDI injection. However, when I went to run the unit tests, they failed:

 

org.jboss.shrinkwrap.api.exporter.ArchiveExportException: File could not be created: target/test.jar
 at org.jboss.shrinkwrap.impl.base.exporter.AbstractStreamExporterImpl.getOutputStreamToFile(AbstractStreamExporterImpl.java:95)
 at org.jboss.shrinkwrap.impl.base.exporter.AbstractStreamExporterImpl.exportTo(AbstractStreamExporterImpl.java:144)
 at org.jboss.arquillian.container.se.managed.ManagedSEDeployableContainer.materializeArchive(ManagedSEDeployableContainer.java:294)
 at org.jboss.arquillian.container.se.managed.ManagedSEDeployableContainer.deploy(ManagedSEDeployableContainer.java:191)

This didn’t make any sense as the output directories were all writeable etc. I had another similar project that worked. Comparing both projects, I eventually added  a barebones arquillian.xml config file. That did the trick! The magic appears toe be the deploymentExportPath – not sure why this is needed.

<arquillian xmlns="http://jboss.org/schema/arquillian"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="
        http://jboss.org/schema/arquillian
        http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
    <engine>
        <property name="deploymentExportPath">target/deployments</property>
    </engine>
&lt;/arquillian&gt;<span id="mce_SELREST_start" style="overflow:hidden;line-height:0">&#65279;</span>

Background on project:

  • Gradle build
  • Arquillian dependencies:
    • org.jboss.arquillian:arquillian-bom:1.4.0.Final
    • org.jboss.arquillian.junit:arquillian-junit-container:1.4.0.Final
    • org.jboss.arquillian.container:container-se-managed:1.0.2.Final

Published by rcuprak

Ryan Cuprak is an e-formulation analyst at Enginuity PLM and president of the Connecticut Java Users Group that he has run since 2003. At Enginuity PLM he is focused on developing data integrations to convert clients’ data and also user interface development. Prior to joining Enginuity he worked for a startup distributed-computing company, TurboWorx, and Eastman Kodak’s Molecular Imaging Systems group, now part of Carestream Health. At TurboWorx he was a Java developer and also a technical sales engineer supporting both presales and professional services. Cuprak has earned a BS in computer science and biology from Loyola University Chicago. He is a Sun Certified NetBeans IDE Specialist. He can be contacted at rcuprak@acm.org.