Example Code Outputs: "template.mustache"

370 views
Skip to first unread message

Michael Schaefer

unread,
May 2, 2014, 2:51:03 PM5/2/14
to mustac...@googlegroups.com
Hi, 

I recently cloned the project from GitHub and tried to run the example. My pom says I have version "0.8.9-SNAPSHOT". When I run the example, I get the text "template.mustache" instead of the expected response of: 

Name: Item 1
Price: $19.99
  Feature: New!
  Feature: Awesome!
Name: Item 2
Price: $29.99
  Feature: Old.
  Feature: Ugly.
Also, every single template I've tried to use in my project also returns "template.mustache" when I try to execute. My project is using the released version 0.8.14. Odd that it has a larger build number. 

Here is my code to try and use one of these templates: 

public class MustacheTest {
    public String data = "Foo";

    @Test
    public void testMustache() {
        MustacheFactory mf = new DefaultMustacheFactory();
        Mustache mustache = mf.compile("my-template.mustache");
        StringWriter stringWriter = new StringWriter();

        try {
            mustache.execute(stringWriter, new MustacheTest()).flush();
        } catch (IOException e) {
            e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
        }
        //mustache.execute(new PrintWriter(System.out), new Example()).flush();

        String result = stringWriter.toString();

        assertEquals("My data is: Foo", result);
    }
}



Michael Schaefer

unread,
May 4, 2014, 1:13:52 PM5/4/14
to mustac...@googlegroups.com
Also, I made sure I had the latest from GitHub and it does not build or run the tests. 

Git Status:

Me@me { ...ects/mustache/mustache.java }# git status

On branch master

Your branch is up-to-date with 'origin/master'.


nothing to commit, working directory clean


Maven Build:

Me@me { ...ects/mustache/mustache.java }# mvn clean install

[INFO] Scanning for projects...

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Build Order:

[INFO] 

[INFO] mustache.java

[INFO] compiler

[INFO] handlebar

[INFO] codegen

[INFO] indy

[INFO]                                                                         

[INFO] ------------------------------------------------------------------------

[INFO] Building mustache.java 0.8.16-SNAPSHOT

[INFO] ------------------------------------------------------------------------

[INFO] 

[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ mustache.java ---

[INFO] 

[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ mustache.java ---

[INFO] Installing /Users/Michael/dev/projects/mustache/mustache.java/pom.xml to /Users/Michael/.m2/repository/com/github/spullara/mustache/java/mustache.java/0.8.16-SNAPSHOT/mustache.java-0.8.16-SNAPSHOT.pom

[INFO]                                                                         

[INFO] ------------------------------------------------------------------------

[INFO] Building compiler 0.8.16-SNAPSHOT

[INFO] ------------------------------------------------------------------------

Downloading: http://git01.corp.farecompare.com:8080/archiva/repository/internal/com/twitter/util-core/4.0.0/util-core-4.0.0.pom

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Summary:

[INFO] 

[INFO] mustache.java ..................................... SUCCESS [0.182s]

[INFO] compiler .......................................... FAILURE [0.459s]

[INFO] handlebar ......................................... SKIPPED

[INFO] codegen ........................................... SKIPPED

[INFO] indy .............................................. SKIPPED

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 1.257s

[INFO] Finished at: Sun May 04 12:10:48 CDT 2014

[INFO] Final Memory: 8M/21M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal on project compiler: Could not resolve dependencies for project com.github.spullara.mustache.java:compiler:bundle:0.8.16-SNAPSHOT: Failed to collect dependencies for [com.google.guava:guava:jar:16.0.1 (compile), org.scala-lang:scala-library:jar:2.8.1 (provided), com.twitter:util-core:jar:4.0.0 (provided), org.jruby:jruby:jar:1.6.7 (provided), junit:junit:jar:4.8.2 (test), org.codehaus.jackson:jackson-mapper-asl:jar:1.9.3 (test)]: Failed to read artifact descriptor for com.twitter:util-core:jar:4.0.0: Could not transfer artifact com.twitter:util-core:pom:4.0.0 from/to internal (http://git01.corp.farecompare.com:8080/archiva/repository/internal): git01.corp.farecompare.com: nodename nor servname provided, or not known: Unknown host git01.corp.farecompare.com: nodename nor servname provided, or not known -> [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/DependencyResolutionException

[ERROR] 

[ERROR] After correcting the problems, you can resume the build with the command

[ERROR]   mvn <goals> -rf :compiler


Michael Schaefer

unread,
May 4, 2014, 1:15:17 PM5/4/14
to mustac...@googlegroups.com
Wow, that didn't format at all like I had planned, sorry about that.

Sam Pullara

unread,
May 4, 2014, 1:49:38 PM5/4/14
to mustac...@googlegroups.com
It looks to me like you don't have access to the main maven repository where those other dependencies are held. It looks to me like you have an internal mirror (http://git01.corp.farecompare.com:8080/archiva/repository/internal) in your ~/.m2/settings.xml file and right you don't have access to it. I bet if you login to your VPN or temporarily comment out that setting you will be able to build.

Sam



On Sun, May 4, 2014 at 10:15 AM, Michael Schaefer <michael....@farecompare.com> wrote:
Wow, that didn't format at all like I had planned, sorry about that.

--
You received this message because you are subscribed to the Google Groups "mustache.java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mustachejava...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Sam Pullara

unread,
May 4, 2014, 1:50:57 PM5/4/14
to mustac...@googlegroups.com
I'm not sure how you cloned such an old version. Hard for me to tell what is going on from here though.

Sam



Michael Schaefer

unread,
May 4, 2014, 2:21:38 PM5/4/14
to mustac...@googlegroups.com
I will delete it and pull it again. Here is the latest pom on the master branch: 


Says the current version is: 0.8.16-SNAPSHOT

You received this message because you are subscribed to a topic in the Google Groups "mustache.java" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mustachejava/MN0IPWeexN4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mustachejava...@googlegroups.com.

Sam Pullara

unread,
May 4, 2014, 2:41:05 PM5/4/14
to mustac...@googlegroups.com
That is the current master. Try the suggestions for reaching the main maven repo and you should be able to build.

Sam

Michael Schaefer

unread,
May 4, 2014, 3:36:41 PM5/4/14
to mustac...@googlegroups.com
Once I was able to build and install the 0.8.16 version locally (per your suggestion of removing my internal maven mirror from work), everything worked like a charm. Thanks for your help. Great tool. 
Reply all
Reply to author
Forward
0 new messages