[jbehave-dev] [jira] (JBEHAVE-829) Unable to locate stories running from CLI an executable jar built from Eclipse

2012-09-04 Thread Mauro Talevi (JIRA)















































Mauro Talevi
 resolved  JBEHAVE-829 as Not A Bug


Unable to locate stories running from CLI an executable jar built from Eclipse
















Added example showing how the story paths can be listed explicitly. 

Future enhancements should include other mechanisms to find/lookup stories in the classpath.





Change By:


Mauro Talevi
(04/Sep/12 2:48 AM)




Resolution:


NotABug





Fix Version/s:


3.6.10





Status:


Open
Resolved



























This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira





-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




[jbehave-dev] [jira] (JBEHAVE-829) Unable to locate stories running from CLI an executable jar built from Eclipse

2012-09-03 Thread Alexander Lehmann (JIRA)














































Alexander Lehmann
 commented on  JBEHAVE-829


Unable to locate stories running from CLI an executable jar built from Eclipse















can you please mark the issue as resolved with not a bug or change it to improvement and mark it as fixed?




























This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira





-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




[jbehave-dev] [jira] (JBEHAVE-829) Unable to locate stories running from CLI an executable jar built from Eclipse

2012-09-02 Thread Mauro Talevi (JIRA)














































Mauro Talevi
 commented on  JBEHAVE-829


Unable to locate stories running from CLI an executable jar built from Eclipse















Let's add it to examples, e.g. under examples/executable-jar and get it working.



























This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira





-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




[jbehave-dev] [jira] (JBEHAVE-829) Unable to locate stories running from CLI an executable jar built from Eclipse

2012-09-02 Thread Alexander Lehmann (JIRA)














































Alexander Lehmann
 commented on  JBEHAVE-829


Unable to locate stories running from CLI an executable jar built from Eclipse















moved the example to jbehave-core/examples and cleaned up the project a bit

https://github.com/alexlehm/jbehave-core/commit/4f2cbaa505d64efea28ce4a55e74bb8b82141ea0
https://github.com/alexlehm/jbehave-core/commit/9eb688611c43ed97e7155839ef197baad999ae08




























This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira





-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




[jbehave-dev] [jira] (JBEHAVE-829) Unable to locate stories running from CLI an executable jar built from Eclipse

2012-09-01 Thread Mauro Talevi (JIRA)














































Mauro Talevi
 commented on  JBEHAVE-829


Unable to locate stories running from CLI an executable jar built from Eclipse















How are you running from CLI?  What don't you try using Maven or Ant to build your jars if you want to run from CLI? 

The jar you provide is not very useful.   It would be more useful if you provide a same Eclipse project and told us how you run your stories from CLI.



























This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira





-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




[jbehave-dev] [jira] (JBEHAVE-829) Unable to locate stories running from CLI an executable jar built from Eclipse

2012-09-01 Thread Alexander Lehmann (JIRA)












































 
Alexander Lehmann
 edited a comment on  JBEHAVE-829


Unable to locate stories running from CLI an executable jar built from Eclipse
















The problem comes from the fact that running the tests inside Eclipse or Maven works quite different from running it from inside a jar.

When running the story from the source files and classes inside Eclipse, you can use LoadFromRelativeFile and the storyPaths method can use findPaths to look up the actual files in the directory.

Eclipse will copy the story files to bin or target directory that will also be the directory for the class that jbehave is running from (the JUnitStories subclass), when running in maven, all files are in target as well.

When running inside the jar, the classes are found inside the jar which translates back to the local directory where is is located in, but the the findPaths methods looks in that directory and will not find anything.

For this to work in a jar, you have to change the StoryLoader to LoadFromClasspath(getClass()), however finding the stories will not work at all I think.

You can explicitly list your story files in the storyPaths method like this, this makes the stories run from the jar.


protected ListString storyPaths()
{
  return Arrays.asList("stories/cx/lehmann/jbehave/jbehave_simple/stories/cleanup.story");
}


this is a bit inflexible however (if you change the list of your stories frequently) or read the list from a config file.

If you are running the stories from the classpath in Eclipse, you have to make sure that the classpath matches the paths for the stories, if the path doesn't match, the stories will not be found inside Eclipse or inside the jar.




























This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira





-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




[jbehave-dev] [jira] (JBEHAVE-829) Unable to locate stories running from CLI an executable jar built from Eclipse

2012-09-01 Thread Alexander Lehmann (JIRA)














































Alexander Lehmann
 updated  JBEHAVE-829


Unable to locate stories running from CLI an executable jar built from Eclipse
















example project





Change By:


Alexander Lehmann
(01/Sep/12 6:46 PM)




Attachment:


jbehave-simple.zip



























This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira





-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




[jbehave-dev] [jira] (JBEHAVE-829) Unable to locate stories running from CLI an executable jar built from Eclipse

2012-09-01 Thread Alexander Lehmann (JIRA)














































Alexander Lehmann
 commented on  JBEHAVE-829


Unable to locate stories running from CLI an executable jar built from Eclipse















I have created a minimal project that can be used to show the issue, this is essentially an empty project created with the jbehave-simple archetype, the pom file creates an executable jar with the package goal.

The resulting file can be run with java -jar jbehave-simple*.jar, which doesn't find any stories, when running the test with the unpacked files (either by running the main class in eclipse or unpacking the executable and running it with java -cp . mainclass) will find the story file.




























This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira





-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email




[jbehave-dev] [jira] (JBEHAVE-829) Unable to locate stories running from CLI an executable jar built from Eclipse

2012-09-01 Thread Alexander Lehmann (JIRA)












































 
Alexander Lehmann
 edited a comment on  JBEHAVE-829


Unable to locate stories running from CLI an executable jar built from Eclipse
















The problem comes from the fact that running the tests inside Eclipse or Maven works quite different from running it from inside a jar.

When running the story from the source files and classes inside Eclipse, you can use LoadFromRelativeFile and the storyPaths method can use findPaths to look up the actual files in the directory.

Eclipse will copy the story files to bin or target directory that will also be the directory for the class that jbehave is running from (the JUnitStories subclass), when running in maven, all files are in target as well.

When running inside the jar, the classes are found inside the jar which translates back to the local directory where is is located in, but the the findPaths methods looks in that directory and will not find anything.

For this to work in a jar, you have to change the StoryLoader to LoadFromClasspath(getClass()), however finding the stories will not work at all.

You can explicitly list your story files in the storyPaths method like this, this makes the stories run from the jar.


protected ListString storyPaths()
{
  return Arrays.asList("stories/cx/lehmann/jbehave/jbehave_simple/stories/cleanup.story");
}


this is a bit inflexible however (if you change the list of your stories frequently) or read the list from a config file.

If you are running the stories from the classpath in Eclipse, you have to make sure that the classpath matches the paths for the stories, if the path doesn't match, the stories will not be found inside Eclipse or inside the jar.




























This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira





-
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email