Skip to content
This repository has been archived by the owner on Apr 5, 2019. It is now read-only.

Allow possibility to specify the Working Directory #27

Closed
mdaloia opened this issue Jan 13, 2015 · 2 comments
Closed

Allow possibility to specify the Working Directory #27

mdaloia opened this issue Jan 13, 2015 · 2 comments

Comments

@mdaloia
Copy link
Contributor

mdaloia commented Jan 13, 2015

Currently when the plugin is executed from a project the working directory is the project base dir. [1]
The phantomjs command executes using this directory and there isn't option to change it.

Add a workingDirectory optional parameter to the exec goal to customize it.

I think that given that this goal it is bound by default to the lifecycle phase test the default working directory must be the ${project.build.testOutputDirectory} with the posibility to change it. [2]

[1]
PhantomJsProcessBuilder.start() uses ProcessBuilder and looking at the JavaDoc of java.lang.ProcessBuilder.directory() we find this:

"The returned value may be null -- this means to use the working directory of the current Java process, usually the directory named by the system property user.dir, as the working directory of the child process."

[2]
This will break backward compatibility but to get the same behavior of version < 0.5 you can set <workingDirectory>${project.basedir}</workingDirectory> inside the section of this plugin.

@mdaloia mdaloia changed the title Allow posibility to specify the Working Directory Allow possibility to specify the Working Directory Jan 13, 2015
mdaloia added a commit to mdaloia/phantomjs-maven-plugin that referenced this issue Jan 13, 2015
possibility to set the Working directory.

Also, fixed the CachedArtifactTest because it was platform dependent.
mdaloia pushed a commit to mdaloia/phantomjs-maven-plugin that referenced this issue Feb 3, 2015
The default working directory is ${project.build.testOutputDirectory} as
said in the issue klieber#27 and the integration
tests projects have other structure.
@klieber
Copy link
Owner

klieber commented Feb 14, 2015

@mdaloia thanks for your contribution. I think the workingDirectory parameter makes sense but I'm not interested in breaking compatibility just to default it to ${project.build.testOutputDirectory}. If you're willing to update your pull request to remove that default I'll get it merged in.

mdaloia pushed a commit to mdaloia/phantomjs-maven-plugin that referenced this issue Feb 17, 2015
mdaloia pushed a commit to mdaloia/phantomjs-maven-plugin that referenced this issue Feb 17, 2015
Given that the default value for the parameter "workingDirectory" was
reverted to "${project.basedir}" as requested in
klieber#27, the changes on the integration tests
settings are redundant.

This reverts commit 62a5736.
mdaloia pushed a commit to mdaloia/phantomjs-maven-plugin that referenced this issue Feb 17, 2015
IT because it seems that the test "exec-with-command-line-options"
sometimes it doesn't find the text to assert.

Part of klieber#27
@mdaloia
Copy link
Contributor Author

mdaloia commented Feb 17, 2015

@klieber I updated the pull request but it seems that Travis-CI is having some misbehavior with the IT tests, mostly with exec-with-command-line-options but sometime there are others (e.g. simple-it). For example in this build 3/3 jobs failed. After deleting only a blank line in this build 2/3 jobs failed.
As an admin of the project on Travis-CI maybe you can see the build.log for each IT test or you can run the IT tests with -e -X maven args to know what it's going on.
When I run locally the mvn verify -Prun-its it runs successfully every time.

My environment is:

  • Windows 7 x64
  • Oracle Java JDK 1.8.0_25
  • Maven 3.2.3

This is a log excerpt:

[INFO] Building: exec-with-command-line-options/pom.xml
[INFO] run script verify.groovy
[INFO] ..FAILED (11.1 s)
[INFO] The post-build script did not succeed. phantomjs script execution failed.. Expression: buildLog.contains(Documentation can be found at the web site, http://phantomjs.org.)

@klieber klieber closed this as completed in 99fbd6a Mar 5, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants