0

I tried to run Maven (never used it, just installed it with help of this guide) on my Windows 7 Machine to build the Alexa Skill Kit Example

This was my output:

D:\Downloads\Chrome\alexa-skills-kit-java-master>mvn assembly:assembly -DdescriptorId=jar-with-dependencies package
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Alexa Skills Kit 1.2
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-assembly-plugin:2.2-beta-5:assembly (default-cli) > package @ alexa-skills-kit >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ alexa-skills-kit ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Downloads\Chrome\alexa-skills-kit-java-master\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ alexa-skills-kit ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ alexa-skills-kit ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Downloads\Chrome\alexa-skills-kit-java-master\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ alexa-skills-kit ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ alexa-skills-kit ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ alexa-skills-kit ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: D:\Downloads\Chrome\alexa-skills-kit-java-master\target\alexa-skills-kit-1.2.jar
[INFO]
[INFO] <<< maven-assembly-plugin:2.2-beta-5:assembly (default-cli) < package @ alexa-skills-kit <<<
[INFO]
[INFO] --- maven-assembly-plugin:2.2-beta-5:assembly (default-cli) @ alexa-skills-kit ---
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] META-INF/ already added, skipping
[INFO] META-INF/maven/ already added, skipping
[INFO] META-INF/MANIFEST.MF already added, skipping
[INFO] META-INF/ already added, skipping
[INFO] META-INF/LICENSE already added, skipping
[INFO] META-INF/maven/ already added, skipping
[INFO] META-INF/maven/com.fasterxml.jackson.core/ already added, skipping
[INFO] com/ already added, skipping
[INFO] com/fasterxml/ already added, skipping
[INFO] com/fasterxml/jackson/ already added, skipping
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping Alexa Skills Kit
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.708 s
[INFO] Finished at: 2017-02-25T12:21:53+01:00
[INFO] Final Memory: 16M/224M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:assembly (default-cli) on project alexa-skills-kit: Failed to create assembly: Error creating assembly archive
jar-with-dependencies: invalid END header (bad central directory offset) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

mvn -version:

Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5; 2015-11-10T17:41:47+01:00)
Maven home: C:\Program Files\Apache\maven
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_45\jre
Default locale: de_DE, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

How can I fix this problem?

  • 1
    can you try with `mvn clean package` command. and why are you using `mvn assembly:assembly -DdescriptorId=jar-with-dependencies package` i dont see this instruction in the readme of git repo. – Amit Feb 25 '17 at 11:49
  • btw i tried building this on my system and its working fine. – Amit Feb 25 '17 at 12:08
  • @AmitK "_Go to the the root directory containing pom.xml, and run 'mvn assembly:assembly -DdescriptorId=jar-with-dependencies package'. This will generate a zip file named "alexa-skills-kit-samples-1.0-jar-with-dependencies.jar" in the target directory._" [here] (https://github.com/amzn/alexa-skills-kit-java/tree/master/samples/src/main/java/helloworld) I tried to use `mvn clean package` but the problem is the dependencies will not be included in the jar (but it builded sucessfully). – user3880174 Feb 25 '17 at 12:29
  • its clearly mentioned in the readme that it required java 8 and you are trying to build it with java 7 , which is clearly mentioned in `mvn -version` o/p of yours. – Amit Feb 25 '17 at 12:32
  • found that in the page which you mentioned , under aws lambda setup. point 6 `Select the runtime as Java 8` – Amit Feb 25 '17 at 12:33
  • from aws lambda https://aws.amazon.com/lambda/faqs/ **Q: What is the JVM environment Lambda uses for execution of my function? Lambda provides the Amazon Linux build of openjdk 1.8.** – Amit Feb 25 '17 at 12:35
  • I changed my `JAVA_HOME` to the directory where Java 1.8.0_121 is located (And checked it with mvn -version). I still got the same error messages. – user3880174 Feb 25 '17 at 13:17
  • its weird can we continue on a chat , to discuss issue in more detail ? – Amit Feb 25 '17 at 13:18
  • @AmitK thank you for this opportunity but I just installed Ubuntu and the built worked there. Yeah, its realy weird why its not working on my windows machine :/. – user3880174 Feb 25 '17 at 16:14
  • it can't be windows problem – Amit Feb 25 '17 at 17:29

2 Answers2

0
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5:assembly (default-cli) on project alexa-skills-kit: Failed to create assembly: Error creating assembly archive
jar-with-dependencies: invalid END header (bad central directory offset) -> [Help 1]

From that error message is clearly that some of your dependency or jar file is corrupted. I checked on the alexa-skills-kit and to make clear is the instruction stated to do the maven command in AWS instead from your local machine?

Sukma Wardana
  • 540
  • 8
  • 21
  • Yes I need to run it on my local machine. "Go to the the root directory containing pom.xml, and run 'mvn assembly:assembly -DdescriptorId=jar-with-dependencies package'. This will generate a zip file named "alexa-skills-kit-samples-1.0-jar-with-dependencies.jar" in the target directory." (https://github.com/amzn/alexa-skills-kit-java/tree/master/samples/src/main/java/helloworld) Later on I would upload it on the Amazon Lambda server. – user3880174 Feb 25 '17 at 12:33
0

Seems to be that your jar file of maven-assembly-plugin is corrupted. It can be if you first tried to execute maven build from IDE without maven installed on your computer, and only then installed maven.

So, as was said previously in this post, you can remove all content of .m2/repository directory and then rebuild your application with maven.

biruk1230
  • 3,042
  • 4
  • 16
  • 29