Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing double-execution bug #92

Merged
merged 2 commits into from
Jul 31, 2012
Merged

Conversation

dfreeman
Copy link
Contributor

A fresh version of the "please don't execute my resources and compile goals twice" fix originally submitted here

@searls, I have the gh-pages update too, and am happy to submit it as well, but as it's only a single line (and to my knowledge you can't submit a multi-branch pull request), it might be easier for you to just update yourself. Let me know which you prefer.
I also imagine you'll want to update the archetype you've got hosted at searls-maven-repository.googlecode.com

I don't believe there's a way for the plugin to detect whether the <extensions>true</extensions> is present, as the resulting error if it's missing will occur during Maven's startup, long before the plugin has a chance to execute.

@searls
Copy link
Owner

searls commented Jul 31, 2012

Excellent, @dfreeman. Does the error happen so early in Maven's startup that we have no hope of even getting a warn out to the logger at any point? If not, then I think the README and the gh-pages should have some gigantic warning in big bold letters with the error that a user would get and the (at-the-end-of-the-day-not-so-difficult) solution.

I just did a near total-rewrite of jasmine-rails, so I'm too tuckered out to work on this, but I'm going to do my best to get to merging and cutting a release tomorrow.

Test failures I attributed to Selenium issues masked missing execution
tags from examples that didn't exist last time I did this.
@brian428
Copy link

Thank you very much, Dan and Justin. I'll give this a shot as soon as it's merged!

searls added a commit that referenced this pull request Jul 31, 2012
@searls searls merged commit 430c5d9 into searls:master Jul 31, 2012
@searls
Copy link
Owner

searls commented Jul 31, 2012

I just pulled this in, but it triggered a cuke failure (features/custom_directories.feature)

Feature: custom source and spec directories

  In order to organize the project how I see fit
  I want to specify custom directories for my JavaScript source and specs

  Scenario: custom spec and source directories                       # features/custom_directories.feature:6
    Given I am currently in the "jasmine-webapp-custom-dirs" project # features/step_definitions/mvn_steps.rb:1
    When I run "mvn clean test"                                      # features/step_definitions/mvn_steps.rb:6
    Then the build should succeed                                    # features/step_definitions/mvn_steps.rb:21
    And I should see "Results: 1 specs, 0 failures"                  # features/step_definitions/mvn_steps.rb:25
      expected "[INFO] Scanning for projects...\n[INFO]                                                                         \n[INFO] ------------------------------------------------------------------------\n[INFO] Building Example Webapp using Jasmine Maven Plugin using custom directories 1.1.0.1-SNAPSHOT\n[INFO] ------------------------------------------------------------------------\n[INFO] \n[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ jasmine-webapp-custom-dirs ---\n[INFO] Deleting /Users/justin/code/java/jasmine-maven-plugin/src/test/resources/examples/jasmine-webapp-custom-dirs/target\n[INFO] \n[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ jasmine-webapp-custom-dirs ---\n[debug] execute contextualize\n[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!\n[INFO] skip non existing resourceDirectory /Users/justin/code/java/jasmine-maven-plugin/src/test/resources/examples/jasmine-webapp-custom-dirs/src/main/resources\n[INFO] \n[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ jasmine-webapp-custom-dirs ---\n[INFO] No sources to compile\n[INFO] \n[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ jasmine-webapp-custom-dirs ---\n[debug] execute contextualize\n[WARNING] Using platform encoding (MacRoman actually) to copy filtered resources, i.e. build is platform dependent!\n[INFO] skip non existing resourceDirectory /Users/justin/code/java/jasmine-maven-plugin/src/test/resources/examples/jasmine-webapp-custom-dirs/src/test/resources\n[INFO] \n[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ jasmine-webapp-custom-dirs ---\n[INFO] No sources to compile\n[INFO] \n[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ jasmine-webapp-custom-dirs ---\n[INFO] No tests to run.\n[INFO] Surefire report directory: /Users/justin/code/java/jasmine-maven-plugin/src/test/resources/examples/jasmine-webapp-custom-dirs/target/surefire-reports\n\n-------------------------------------------------------\n T E S T S\n-------------------------------------------------------\n\nResults :\n\nTests run: 0, Failures: 0, Errors: 0, Skipped: 0\n\n[INFO] \n[INFO] >>> jasmine-maven-plugin:1.1.0.1-SNAPSHOT:test (default) @ jasmine-webapp-custom-dirs >>>\n[INFO] \n[INFO] --- jasmine-maven-plugin:1.1.0.1-SNAPSHOT:resources (default-resources) @ jasmine-webapp-custom-dirs ---\n[INFO] Processing JavaScript Sources\n[WARNING] JavaScript source folder was expected but was not found. Set configuration property `jsSrcDir` to the directory containing your JavaScript sources. Skipping jasmine:resources processing.\n[INFO] \n[INFO] --- jasmine-maven-plugin:1.1.0.1-SNAPSHOT:generateManualRunner (default-generateManualRunner) @ jasmine-webapp-custom-dirs ---\n[WARNING] Skipping manual spec runner generation. Check to make sure that both JavaScript directories `/Users/justin/code/java/jasmine-maven-plugin/src/test/resources/examples/jasmine-webapp-custom-dirs/src/main/javascript` and `/Users/justin/code/java/jasmine-maven-plugin/src/test/resources/examples/jasmine-webapp-custom-dirs/src/test/javascript` exist.\n[INFO] \n[INFO] --- jasmine-maven-plugin:1.1.0.1-SNAPSHOT:testResources (default-testResources) @ jasmine-webapp-custom-dirs ---\n[INFO] Processing JavaScript Specs\n[WARNING] JavaScript test source folder was expected but was not found. Set configuration property `jsTestSrcDir` to the directory containing your specs. Skipping jasmine:testResources processing.\n[INFO] \n[INFO] <<< jasmine-maven-plugin:1.1.0.1-SNAPSHOT:test (default) @ jasmine-webapp-custom-dirs <<<\n[INFO] \n[INFO] --- jasmine-maven-plugin:1.1.0.1-SNAPSHOT:test (default) @ jasmine-webapp-custom-dirs ---\n[INFO] Executing Jasmine Specs\n[INFO] \n-------------------------------------------------------\n J A S M I N E   S P E C S\n-------------------------------------------------------\n[INFO] \n\nResults: 0 specs, 0 failures\n\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD SUCCESS\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 4.442s\n[INFO] Finished at: Tue Jul 31 11:15:33 EDT 2012\n[INFO] Final Memory: 11M/81M\n[INFO] ------------------------------------------------------------------------\n" to match /Results: 1 specs, 0 failures.*/ (RSpec::Expectations::ExpectationNotMetError)
      ./features/step_definitions/mvn_steps.rb:26:in `/^I should see "([^"]*)"$/'
      features/custom_directories.feature:11:in `And I should see "Results: 1 specs, 0 failures"'

Looking into it now.

@dfreeman
Copy link
Contributor Author

I'll confess that cuke and my laptop have a history of 'disagreement', but I thought I had sorted through pretty well. Please let me know if there's anything I can do to help out debugging.

@searls
Copy link
Owner

searls commented Jul 31, 2012

Yeah, I have about zero clue what the cause is. Works fine without the patch applied, does not add specs or source (and thus, 0 specs found) when the patch is applied

@searls
Copy link
Owner

searls commented Jul 31, 2012

It seems that it's not picking up the configuration. It's printing out these directories

jasmine-maven-plugin/src/test/resources/examples/jasmine-webapp-custom-dirs/src/main/javascript

jasmine-maven-plugin/src/test/resources/examples/jasmine-webapp-custom-dirs/src/test/javascript

But the configured directories are in webapp & src/test/jasmine.

@dfreeman
Copy link
Contributor Author

Yeah, I just came to the same conclusion. What's odd is that it seems to have no trouble picking up other configuration, though, e.g. customRunnerTemplate.

Unfortunately I don't have time to dig in any deeper right now. I'm sorry this isn't just going smoothly; I imagine you were as eager to put this to rest as I was.

@searls
Copy link
Owner

searls commented Jul 31, 2012

I got it passing. The configuration was underneath the <execution>... so I take it that means configurations underneath the execution elements will absolutely not get picked up with extensions enabled. (Which would be another thing to put in big bold letters on the READMEs)

    <build>
        <plugins>
            <plugin>
                <groupId>com.github.searls</groupId>
                <artifactId>jasmine-maven-plugin</artifactId>
                <version>${project.version}</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <jsSrcDir>${project.basedir}/src/main/webapp/js</jsSrcDir>
                    <jsTestSrcDir>${project.basedir}/src/test/jasmine</jsTestSrcDir>
                </configuration>
            </plugin>
        </plugins>
    </build>

@dfreeman
Copy link
Contributor Author

That was my first impulse too -- which in my mind would be a much bigger issue than the whole extensions problem, as having execution-specific configuration is a fairly common need.

However, when I checked to see if customRunnerTemplate would be picked up or not, I added it directly beneath jsTestSrcDir within the existing configuration tag in the jasmine-webapp-custom-dirs POM.
The debug line I added printed out the phony path I added, and the plugin itself correctly complained that the supplied template path was invalid, so I suspect something more subtle is going on.

@searls
Copy link
Owner

searls commented Jul 31, 2012

Dear subscribers of this thread, 1.2.0.0 is released and merges in this fix (along with coffee 1.3.3, the HtmlUnit 2.9, and jasmine 1.2.0)

@brian428
Copy link

Thanks, just to be clear, all that's needed is to add this to the plugin within the POM?

true



test


@brian428
Copy link

Oops, adding the markup:

<extensions>true</extensions>
<executions>
    <execution>
        <goals>
            <goal>test</goal>
        </goals>
    </execution>
</executions>

@brian428
Copy link

Doh, never mind I see it was added to the markdown. Thanks!

@brian428
Copy link

brian428 commented Aug 2, 2012

I hate to ask, but it looks like the plugin isn't accepting the new HtmlUnit 2.9 BrowserVersion values like CHROME_16 and FIREFOX_10. Assuming the plugin just needs to be updated to accept these, any chance that could sneak into a 1.2.1 or something? Thanks.

@parxier
Copy link

parxier commented Aug 8, 2012

Please note 1.2.0.0 doesn't seem to be compatible with Maven 2. More details on original pull request page: #54

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants