<target name="start.my.jar" description="start my jar">
<echo message="Starting the jar" />
<java jar="${jars.dir}/${my.stub.jar}" fork="true" dir="${jars.dir}" spawn="true">
<sysproperty key="properties.filename" value="${basedir}/path/path/path/filename.properties"/>
<arg value="start" />
</java>
</target>
와 함께 항아리를 실행 개미가
public static MyFacade createFacade() throws FileNotFoundException, IOException {
return createFacade(System.getProperty(properties.filename));
}
후 개미가있다
<target name="test" depends="compile, support" description="perform unit tests">
<mkdir dir="${build.test}" />
<mkdir dir="${test-classes.dir}" />
<javac srcdir="${build.test}" destdir="${test-classes.dir}" debug="${debug}" nowarn="${nowarn}" includeantruntime="false" deprecation="${deprecation}">
<classpath refid="main.classpath" />
</javac>
<junit printsummary="yes" haltonfailure="yes" showoutput="true" dir="${test-classes.dir}" fork="true" forkmode="perBatch" failureproperty="junit.failure" errorproperty="junit.error" haltonerror="no">
<jvmarg value="-Xmx1G" />
<jvmarg value="-Dcom.sun.management.jmxremote" />
<classpath>
<pathelement location="${test-classes.dir}" />
<pathelement location="${classes.dir}" />
<!--
For module restful_api
-->
<pathelement location="${build.deploy}" />
<pathelement location="${classes.dir}" />
<fileset dir="${build.lib}">
<include name="*.jar" />
</fileset>
</classpath>
<formatter type="plain" />
<batchtest fork="yes" todir="${build.test}">
<fileset dir="${build.test}">
<include name="**/*AllTests.java" />
<include name="**/*TestCase.java" />
</fileset>
</batchtest>
</junit>
<fail message="Unittest failures - please check" if="junit.failure" />
<fail message="Unittest errors - please check" if="junit.error" />
</target>
내 테스트는이 테스트 대상 모듈에서 속성을 가져 오지 못했습니다. start.my.jar 대상에 지정된 파일에 대해. 내가 잘못하고있는 것이 있습니까? 당신이 독립적 인 실행 환경만을 java
대상의 속성을 추가하기 때문이다
SEVERE: The RuntimeException could not be mapped to a response, re-throwing to the HTTP container
[junit] java.lang.NullPointerException
[junit] at java.io.File.<init>(File.java:222)
[junit] at com.mycompany.myproduct.sdk.facade.MyFacadeFactory.getInputStream(MyFacadeFactory.java:47)
[junit] at com.mycompany.myproduct.sdk.facade.MyFacadeFactory.loadFacade(MyFacadeFactory.java:43)
[junit] at com.mycompany.myproduct.sdk.facade.MyFacadeFactory.createFacade(MyFacadeFactory.java:32)
[junit] at com.mycompany.myproduct.sdk.facade.MyFacadeFactory.createFacade(MyFacadeFactory.java:28)
[junit] at com.mycompany.myproduct.sdk.resources.impl.TransactionResourceImpl.<init>(TransactionResourceImpl.java:70)
[junit] at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[junit] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
[junit] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
[junit] at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
[junit] at com.sun.jersey.server.spi.component.ResourceComponentConstructor._construct(ResourceComponentConstructor.java:191)
이 createFacade (은 System.getProperty ("properties.filename을")) 반환하려고 일한 적이; – user1097489
사실 내가 properties.filename이지만 여전히 작동하지 않습니다. – ThaSaleni
stacktrace를 게시 할 수 있습니까? – user1097489