Setting up environment for creating custom snaps with junits

I have been using snaplogic and developing using it for a year.

I thought let me set up enviornment for creating custom snap which someone has created already in my company.

When I ran the mvn clean install .

I got the following issue.
Failed to execute goal com.snaplogic.tools:snappack-installer:4.0:generate-schema (default) on project azsnappack: Execution default of goal com.snaplogic.tools:snappack-installer:4.0:generate-schema failed: A required class was missing while executing com.snaplogic.tools:snappack-installer:4.0:generate-schema: com/snaplogic/common/services/CascadingService

Then I though let me check with the latest as it has been ages when this custom snaps was developed.

I downloaded the basic archetype using the command

mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate -DarchetypeCatalog=http://maven.clouddev.snaplogic.com:8080/nexus/content/repositories/master/

And I updated the code accordingly with latest code.

Then Build got passed but the junits are failing with the issue.

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0 sec <<< FAILURE!
testSingleDocGeneratorFunctionality(com.snaplogic.snaps.azsnappack.SingleDocGeneratorTest)  Time elapsed: 0 sec  <<< ERROR!
java.lang.NoSuchMethodError: com.snaplogic.snap.api.OutputViewsImpl.add(Lcom/snaplogic/snap/view/OutputView;)V
	at com.snaplogic.snap.test.harness.TestResultImpl.addOutputView(TestResultImpl.java:116)
	at com.snaplogic.snap.test.harness.TestSetupImpl.addOutputView(TestSetupImpl.java:393)
	at com.snaplogic.snap.test.harness.SnapExecutor.createOutputViewFor(SnapExecutor.java:845)
	at com.snaplogic.snap.test.harness.SnapExecutor.evaluate(SnapExecutor.java:426)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

This may be related to an out-of-date dependency. Could you try removing the com/snaplogic folder in your local Maven repository and then rebuilding?

e.g. rm -rf ~/.m2/repository/com/snaplogic/

I got this answer from stackoverflow .

It worked :slight_smile: