Ecwid / ecwid-mailchimp

MailChimp API Wrapper for Java
Apache License 2.0
86 stars 83 forks source link

Cannot build latest version? #2

Closed apresley1 closed 12 years ago

apresley1 commented 12 years ago

I downloaded the latest git repo today, and tried to run: mvn compile

This worked fine.

However, this command: mvn package

Fails with these errors:


T E S T S

Running TestSuite Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@4d20a47e org.apache.maven.surefire.util.SurefireReflectionException: java.lang.reflect.InvocationTargetException; nested exception is java.lang.reflect.InvocationTargetException: null java.lang.reflect.InvocationTargetException 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) 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:113) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75) Caused by: org.testng.TestNGException: Parameter 'mailchimp.test.apikey' is required by @Parameters on method public com.ecwid.mailchimp.method.list.InterestGroupingMethodsTest(java.lang.String,java.lang.String) but has not been marked @Optional or defined

I'm trying to get a jar out of this package to build into an older ant package.

How can I build this into a jar file?

Thanks!

basiliscus commented 12 years ago

Just run the following command in the root project folder:

mvn install -DskipTests=true

Or, if you prefer not to skip the tests, add the following properties to ~/.m2/settings.xml

        <properties>
            <mailchimp.test.username>***</mailchimp.test.username>
            <mailchimp.test.password>***</mailchimp.test.password>
            <mailchimp.test.apikey>***</mailchimp.test.apikey>
            <mailchimp.test.listid>***</mailchimp.test.listid>
        </properties>
apresley1 commented 12 years ago

Thanks so much - skipping the tests worked great.

Now I've got a JAR file - which I can include in our project.

But, how do I instantiate the class and use it? Do you have a sample of this somewhere?

basiliscus commented 12 years ago

I have updated the project so that the integration tests will be skipped unless the credential properties are specified: https://github.com/Ecwid/ecwid-mailchimp/commit/81a52ca9bb0be7a1fe819ff1aa8fac17035a5f0b

Regarding samples: they can be seen in the integration tests classes: SubscribeMethodsTest for example

Basically you should deal with the MailChimpClient.execute() method. Just pass the method object as argument and get the result.

I will consider improving the docs.

basiliscus commented 12 years ago

I've added the sample code to the home wiki page. Please let me know if any further clarifications needed,