DSpace-Labs / SAFBuilder

Builds a Simple Archive Format package from files and a spreadsheet
https://wiki.duraspace.org/display/DSPACE/Simple+Archive+Format+Packager
45 stars 33 forks source link

SAFbuilder error #13

Closed ialiraza closed 8 years ago

ialiraza commented 8 years ago

Hi I'm tring to create Simple archive format. while running safbuilder command it gives error. please help me.

raza@raza:~$ cd SAFBuilder/ raza@raza:~/SAFBuilder$ ./safbuilder.sh -c /home/raza/Desktop/import/16/16-import.csv -z Recompiling SAFBuilder, just a moment... [ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project safbuilder: Failed to clean project: Failed to delete /home/raza/SAFBuilder/target/maven-archiver/pom.properties -> [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 ./safbuilder.sh: 9: ./safbuilder.sh: Syntax error: "(" unexpected

peterdietz commented 8 years ago

Hi @ialiraza, it looks like your OS system has locked the /target/ directory for some reason. It looks like you can work-around this situation by editing safbuilder.sh and add -Dmaven.clean.failOnError=false, thus change line 3 of safbuilder.sh to be:

mvn -Dmaven.clean.failOnError=false --quiet -DskipTests=true clean package

Then re-run this.

ialiraza commented 8 years ago

Hi peterdietz, I have change the Line and re-run but no luck. Giving error ./safbuilder.sh: 9: ./safbuilder.sh: Syntax error: "(" unexpected

ialiraza commented 8 years ago

Hi @peterdietz version 1.x is working fine. but I'm facing problem with master version. getting error ./safbuilder.sh: 9: ./safbuilder.sh: Syntax error: "(" unexpected

please suggest

peterdietz commented 8 years ago

I'm not sure what the problem is, perhaps your parameter input is causing escaping issues. Such as including a double-quote or something. Can you share what your full ./safbuilder.sh command was, including your options? i.e. ./safbuilder.sh -c /path/to/metadata.csv

Instead of running safbuilder from safbuilder.sh, you can invoke it directly from maven. (If you look at the safbuilder.sh file, it contains these commands.)

1) Compile SAFBuilder

mvn clean package

2) Run SAFBuilder, provide your own input in -c /path/to/metadata.csv

mvn exec:java -Dexec.mainClass="safbuilder.BatchProcess" -Dexec.args="-c /Users/peterdietz/Projects/clients/auk/batches/20160316-2015/_sheet.csv"
tdonohue commented 8 years ago

Hi @ialiraza and @peterdietz : I actually encountered that same Syntax error: "(" unexpected recently when trying to use SAFBuilder on Ubuntu 14.04.

In my case the issue was that my system didn't like the #!/bin/sh at the top of the safbuilder.sh.

To fix it, I just had to change that reference to specifically reference BASH shell. So, I changed the first line to be #!/bin/bash and the script worked.

This same shell script issue is described in more detail at: http://ubuntuforums.org/showthread.php?t=499045

I'm not sure if this would occur on other Linux OSes, but it definitely can occur on Ubuntu.

peterdietz commented 8 years ago

Interesting, thanks for the hint @tdonohue. I've updated this project to use bin/bash, so do a git pull to get the latest commit, and then run it again as normal (./safbuilder.sh).

ialiraza commented 8 years ago

Thanks @tdonohue and @peterdietz after modifying the #!/bin/sh to #!/bin/bash in safbuilder.sh line 1 script is working fine.