smallseo.info

mojo

Mojolicious - Perl real-time web framework Mojolicious - Perl real-time web framework

Mojo development - Handling unresolved dependencies in multi module projects

I have a mojo annotated with @requiresDependencyResolution test.

It works for multi-module projects with a single layer of nesting, but a user has reported an issue with a structure such as below.

 -- my_project
    |
    -- pom.xml
    -- submodule1
       |
       -- pom.xml
    -- submodule2
       |
       -- pom.xml
       -- submodule21
         |
         -- pom.xml
       -- submodule22
         |
         -- pom.xml

If submodule21 depends on submodule1 maven reports

Failed to execute goal on project submodule21: Could not resolve dependencies for project org.my:submodule21:jar:1.0-SNAPSHOT: Could not find artifact org.my:submodule1:jar:1.0-SNAPSHOT

Removing the requiresDependencyResolution=test annotation prevents this problem but then I do not have access to the information I require for the mojo to run.

From brief scan of the surefire code on github, it looks to also use requiresDependencyResolution=test but is able to run against this project without issue.

https://github.com/apache/maven-surefire/blob/master/maven-surefire-plugin/src/main/java/org/apache/maven/plugin/surefire/SurefirePlugin.java

https://github.com/apache/maven-surefire/blob/master/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java

The only obvious difference from my own code is that it uses java annotations rather than old style javadoc ones.

How is the surefire mojo achieving this?

My code is

http://code.google.com/p/pitestrunner/source/browse/pitest-maven/src/main/java/org/pitest/maven/PitMojo.java

Example project displaying issue

http://code.google.com/p/pitestrunner/issues/detail?id=71


Source: (StackOverflow)

Perl Mojolicious & Socket.IO doesn't play well

I was trying to experiment with Socket.IO and Perl's Mojolicious. while I was able to perform the same with WebSockets I tried to do the same with Socket.IO (due to wider browser support that I need) it didn't play well.

I'm using the Morbo server. the code is:

#!/usr/bin/env perl
use Mojolicious::Lite;

get '/' => sub {
    my $self = shift;

    $self->render('index');
};

websocket '/echo' => sub {
    my $self       = shift;
    state $counter = 1;

    $self->res->headers->header('Access-Control-Allow-Origin' => "*");
    Mojo::IOLoop->recurring(1.5 => sub {
          my $loop = shift;
          $self->send(sprintf("Websocket request: %d\n",$counter++));

  });
};

app->start;

__DATA__
@@ index.html.ep
<!DOCTYPE html>
<html>
  <head>
     <title>Socket.IO test</title>
     <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
     <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js"></script>
  </head>
  <body>
  <div id="dumper"></div>
<script>
   var ws = new WebSocket('<%= url_for('echo')->to_abs %>');

   ws.onmessage = function(e) {
      var message = e.data;
      console.log(message);
      $("#dumper").text(message);
    };
 // var socket = io.connect('<%= url_for('echo')->to_abs %>');
//  socket.on('data', function (data) {
//    console.log(data);
//  });
</script>


  </body>
</html>

This code part work well (WebSocket), when I uncomment the Socket.IO part, it fails on the io.connect(...) with the following error (Header and Response):

Request:

GET /socket.io/1/?t=1385234823089 HTTP/1.1
Host: 127.0.0.1:3000
Connection: keep-alive
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.63 Safari/537.31
Accept: */*
Referer: http://127.0.0.1:3000/
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3

Response:

HTTP/1.1 404 Not Found
Connection: keep-alive
Content-Type: text/html;charset=UTF-8
Date: Sat, 23 Nov 2013 19:27:03 GMT
Content-Length: 6163
Server: Mojolicious (Perl)

The Request I get from the client while using the WebSocket is this:

GET ws://127.0.0.1:3000/echo HTTP/1.1
Pragma: no-cache
Origin: http://127.0.0.1:3000
Host: 127.0.0.1:3000
Sec-WebSocket-Key: zgob5gss5XTr9vzYwYNe+A==
Upgrade: websocket
Sec-WebSocket-Extensions: x-webkit-deflate-frame
Cache-Control: no-cache
Connection: Upgrade
Sec-WebSocket-Version: 13

it seems that Socket.IO doenst request for the socket upgrade? Also, Mojo is not aware of this route:

/socket.io/1

I also tried replacing:

io.connect('<%= url_for('echo')->to_abs %>');

with io.connect('http://localhost:300/echo');


Source: (StackOverflow)

Is it possible to use Mojolicious tag helpers in external JS files?

I am currently working on cleaning up a little web app I've written in Mojolicious. As part of that cleanup I am separating out my javascript into the public directory from my html.ep files.

The problem I have though is I don't seem to be able to reference tag helpers any more, like 'url_for' or even referencing values in the stash such as '<% $stashvalue %>'.

Any idea's on how or if I can do this is very much appreciated.

cheers.


Source: (StackOverflow)

Maven docs after codehaus terminated?

Where can I get all the org.codehaus.mojo Maven plugins docs and sources once Codehaus.org was terminated?


Source: (StackOverflow)

lighttpd + perl + mojolicious =?

Does mojolicious working under the lighttpd web-server? How to cofigure? Does I need setup the FastCGI? It's my first usage of lighttpd.


Source: (StackOverflow)

Why is my use of hypnotoad crashing on Heroku?

I'm trying to get hypnotoad with a Mojolicious::Lite app running on Heroku with Perloku. There's something that doesn't happen when hypnotoad gets into its run loop that causes it to crash. I figure I'm missing something simple, but the Heroku docs haven't helped and I haven't been able to coax good error messages out of this.

I start with a very simple application so show some environment variables:

#!/usr/bin/env perl
# today
use Mojolicious::Lite;

get '/' => sub {
    my $c = shift;

    my $content = "Perl: $^X Pid: $$\n\n";
    foreach my $key ( keys %ENV ) {
        next unless $key =~ /Mojo|toad/i;
        $content .= "$key $ENV{$key}\n";
        }

    $c->stash( content => $content );

    $c->render('index');
    };

app->start;

__DATA__

@@ index.html.ep
% layout 'default';
% title 'Welcome';
<p>Welcome to the Mojolicious real-time web framework!</p>

<pre>
<%= $content %>
</pre>

@@ layouts/default.html.ep
<!DOCTYPE html>
<html>
  <head><title><%= title %></title></head>
  <body><%= content %></body>
</html>

When I run this locally, I have no problem. I see from the environment variables that my program is run under hypnotoad:

Welcome to the Mojolicious real-time web framework!

Perl: /Users/brian/Dropbox/bin/perls/perl5.20.0 Pid: 40006

HYPNOTOAD_PID 39981
MOJO_HELP 
HYPNOTOAD_TEST 
HYPNOTOAD_EXE /Users/brian/bin/perls/hypnotoad5.20.0
MOJO_REUSE 0.0.0.0:8080:6
HYPNOTOAD_REV 3
HYPNOTOAD_APP /Users/brian/Desktop/toady.d/toady
MOJO_MODE production
MOJO_HOME
HYPNOTOAD_STOP 
HYPNOTOAD_FOREGROUND

Now, I deploy this with Mojolicious::Command::deploy::heroku:

% toady deploy heroku --create

This is running at https://frozen-brushlands-4002.herokuapp.com, using the default Perloku file:

#!/bin/sh
./toady daemon --listen http://*:$PORT --mode production

This isn't running hypnotoad though, despite some references I've seen that says that's what I should get. The application works, though:

Welcome to the Mojolicious real-time web framework!

Perl: /app/vendor/perl/bin/perl Pid: 3

MOJO_REUSE 0.0.0.0:12270:4
MOJO_HOME 
MOJO_HELP 
MOJO_MODE production
MOJO_EXE ./toady

I figured I could just change the Perloku file to start hypnotoad:

#!/bin/sh
/app/vendor/perl/bin/perl /app/vendor/perl-deps/bin/hypnotoad toady

hypnotoad starts and almost immediately shuts down with no other log messages:

% heroku logs --app ...
2015-01-04T09:23:36.516864+00:00 heroku[web.1]: Starting process with command `./Perloku`
2015-01-04T09:23:38.321628+00:00 heroku[web.1]: State changed from starting to crashed

I can change the invocation to use the -t to test the app to see if :

#!/bin/sh
/app/vendor/perl/bin/perl /app/vendor/perl-deps/bin/hypnotoad -t toady

That works and I get the "Everything looks good!" message, so hypnotoad is running:

2015-01-04T09:36:36.955680+00:00 heroku[web.1]: Starting process with command `./Perloku`
2015-01-04T09:36:38.340717+00:00 app[web.1]: Everything looks good!
2015-01-04T09:36:39.085887+00:00 heroku[web.1]: State changed from starting to crashed

I turn on Mojo debug logging, but I don't see additional output other than my own statements.

#!/usr/bin/env perl
use Mojolicious::Lite;

$|++;

my $log = app->log;

$log->level( 'debug' );

$log->debug( "INC: @INC" );

get '/' => sub {
    ...;
    };

$log->debug( "Right before start" );
my $app = app->start;
$log->debug( "Right after start" );

$app; # must return application object

I tried other things, such as making it load a module I know is not there and I get the expected "Could not find" error in the logs.

Running from the shell in heroku (heroku run bash) was not illuminating. The output of mojo version is the same as on my local machine:

$ perl vendor/perl-deps/bin/mojo version
CORE
  Perl        (v5.16.2, linux)
  Mojolicious (5.71, Tiger Face)

OPTIONAL
  EV 4.0+                 (n/a)
  IO::Socket::Socks 0.64+ (n/a)
  IO::Socket::SSL 1.84+   (n/a)
  Net::DNS::Native 0.15+  (n/a)

You might want to update your Mojolicious to 5.72.

I figure there's something really simple that I'm missing, but at the same time, none of this is architected for easy debugging.


Oleg gets a little closer, but there are still problems. I had tried the foreground option before and run into the same problems but failed to mention it.

If I start hypnotoad in the foreground, it tries to bind to an address. It can't bind to port 80 (or 443) and crashes, and it can listen to 127.0.0.1: almost, but it looks like it fails to completely listen:

2015-01-13T11:47:54+00:00 heroku[slug-compiler]: Slug compilation started
2015-01-13T11:48:32+00:00 heroku[slug-compiler]: Slug compilation finished
2015-01-13T11:48:32.735095+00:
00 heroku[api]: Deploy dcab778 by ...
2015-01-13T11:48:32.735095+00:00 heroku[api]: Release v31 created by ...
2015-01-13T11:48:32.969489+00:00 heroku[web.1]: State changed from crashed to starting
2015-01-13T11:48:34.909134+00:00 heroku[web.1]: Starting process with command `./Perloku`
2015-01-13T11:48:36.045985+00:00 app[web.1]: Can't create listen socket: Permission denied at /app/vendor/perl-deps/lib/perl5/Mojo/IOLoop.pm line 120.
2015-01-13T11:48:36.920004+00:00 heroku[web.1]: Process exited with status 13
2015-01-13T11:48:36.932014+00:00 heroku[web.1]: State changed from starting to crashed

Here's with an unprivileged port:

2015-01-13T11:39:10+00:00 heroku[slug-compiler]: Slug compilation started
2015-01-13T11:39:44+00:00 heroku[slug-compiler]: Slug compilation finished
2015-01-13T11:39:44.519679+00:00 heroku[api]: Deploy bbd1f68 by ...
2015-01-13T11:39:44.519679+00:00 heroku[api]: Release v29 created by ...
2015-01-13T11:39:44.811111+00:00 heroku[web.1]: State changed from crashed to starting
2015-01-13T11:39:47.382298+00:00 heroku[web.1]: Starting process with command `./Perloku`
2015-01-13T11:39:48.454706+00:00 app[web.1]: [Tue Jan 13 11:39:48 2015] [info] Listening at "http://*:8000".
2015-01-13T11:39:48.454733+00:00 app[web.1]: Server available at http://127.0.0.1:8000.
2015-01-13T11:39:48.454803+00:00 app[web.1]: [Tue Jan 13 11:39:48 2015] [info] Manager 3 started.
2015-01-13T11:39:48.480084+00:00 app[web.1]: [Tue Jan 13 11:39:48 2015] [info] Creating process id file "/app/hypnotoad.pid".
2015-01-13T11:40:47.703110+00:00 heroku[web.1]: Stopping process with SIGKILL
2015-01-13T11:40:47.702867+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2015-01-13T11:40:48.524470+00:00 heroku[web.1]: Process exited with status 137
2015-01-13T11:40:48.534002+00:00 heroku[web.1]: State changed from starting to crashed

Source: (StackOverflow)

A required class was missing while executing org.apache.maven.plugins:maven-war-plugin:2.1.1:war

Here is my clean install -x result:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building test Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ test ---
[INFO] Deleting C:\Users\utopcu\workspace\test\target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ test ---
[WARNING] Using platform encoding (Cp1254 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ test ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ test ---
[WARNING] Using platform encoding (Cp1254 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\utopcu\workspace\test\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ test ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ test ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ test ---
[WARNING] Error injecting: org.apache.maven.plugin.war.WarMojo
java.lang.NoClassDefFoundError: org/apache/maven/shared/filtering/MavenFilteringException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2483)
    at java.lang.Class.getDeclaredConstructors(Class.java:1891)
    at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:245)
    at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:99)
    at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:653)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:863)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:790)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:278)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:210)
    at com.google.inject.internal.InjectorImpl.getProviderOrThrow(InjectorImpl.java:986)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1019)
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:982)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1032)
    at org.eclipse.sisu.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:44)
    at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:86)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:55)
    at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
    at org.eclipse.sisu.plexus.lifecycles.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:134)
    at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:109)
    at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
    at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
    at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:47)
    at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:997)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1047)
    at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:993)
    at com.google.inject.Scopes$1$1.get(Scopes.java:59)
    at org.eclipse.sisu.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:82)
    at org.eclipse.sisu.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:52)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:259)
    at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:251)
    at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:459)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:97)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:318)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:153)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:414)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:357)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:47)
Caused by: java.lang.ClassNotFoundException: org.apache.maven.shared.filtering.MavenFilteringException
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    ... 55 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.342s
[INFO] Finished at: Mon Aug 26 14:09:27 EEST 2013
[INFO] Final Memory: 11M/105M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project test: Execution default-war of goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war failed: A required class was missing while executing org.apache.maven.plugins:maven-war-plugin:2.1.1:war: org/apache/maven/shared/filtering/MavenFilteringException
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-war-plugin:2.1.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/utopcu/.m2/repository/org/apache/maven/plugins/maven-war-plugin/2.1.1/maven-war-plugin-2.1.1.jar
[ERROR] urls[1] = file:/C:/Users/utopcu/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.0.6/maven-reporting-api-2.0.6.jar
[ERROR] urls[2] = file:/C:/Users/utopcu/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.0-alpha-7/doxia-sink-api-1.0-alpha-7.jar
[ERROR] urls[3] = file:/C:/Users/utopcu/.m2/repository/commons-cli/commons-cli/1.0/commons-cli-1.0.jar
[ERROR] urls[4] = file:/C:/Users/utopcu/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
[ERROR] urls[5] = file:/C:/Users/utopcu/.m2/repository/org/apache/maven/maven-archiver/2.4.1/maven-archiver-2.4.1.jar
[ERROR] urls[6] = file:/C:/Users/utopcu/.m2/repository/org/codehaus/plexus/plexus-archiver/1.2/plexus-archiver-1.2.jar
[ERROR] urls[7] = file:/C:/Users/utopcu/.m2/repository/org/codehaus/plexus/plexus-io/1.0.1/plexus-io-1.0.1.jar
[ERROR] urls[8] = file:/C:/Users/utopcu/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.13/plexus-interpolation-1.13.jar
[ERROR] urls[9] = file:/C:/Users/utopcu/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar
[ERROR] urls[10] = file:/C:/Users/utopcu/.m2/repository/com/thoughtworks/xstream/xstream/1.3.1/xstream-1.3.1.jar
[ERROR] urls[11] = file:/C:/Users/utopcu/.m2/repository/xpp3/xpp3_min/1.1.4c/xpp3_min-1.1.4c.jar
[ERROR] urls[12] = file:/C:/Users/utopcu/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.5/plexus-utils-2.0.5.jar
[ERROR] urls[13] = file:/C:/Users/utopcu/.m2/repository/org/apache/maven/shared/maven-filtering/1.0-beta-2/maven-filtering-1.0-beta-2.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR] 
[ERROR] -----------------------------------------------------: org.apache.maven.shared.filtering.MavenFilteringException
[ERROR] -> [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/PluginContainerException

And here is my pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>trest</groupId>
    <artifactId>test</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>test Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.1.1</version>
            </plugin>
        </plugins>
    </build>
</project>

I tried to delete repositories and install again. I got this error always. It looks like I need help. I think my mojo plugin is broken but i re installed it several times. Any suggestions?


Source: (StackOverflow)

Starting and stoping listeners in Mojo framework (WebOS)

I am starting WebOS dev and I have a doubt on where should I start and stop my listeners ? I am reading this book but I couldn't find a clear explanation about this. In the sample the author set the listeners in the setup function but I wonder why? isn't a better idea to set them in activate function and stop them in deactivate function as suggested by the template's comments?

In case I am wrong what kind of events should and shouldn't put in setup and activate functions?

When exactly setup, activate, deactivate, cleanup functions are called?

StoryViewAssistant.prototype.setup = function() {
    //HERE, OK?
    this.nextStoryHandler = this.nextStory.bindAsEventListener(this); 
    this.previousStoryHandler = this.previousStory.bindAsEventListener(this); 
    this.controller.listen("nextStory", Mojo.Event.tap, this.nextStoryHandler); 
    this.controller.listen("previousStory", Mojo.Event.tap,this.previousStoryHandler);
    /* add event handlers to listen to events from widgets */

};

StoryViewAssistant.prototype.activate = function(event) {
    //HERE? 
    /* put in event handlers here that should only be in effect when this scene is active. For example, key handlers that are observing the document */
};

StoryViewAssistant.prototype.deactivate = function(event) {
    //HERE? 
    /* remove any event handlers you added in activate and do any other cleanup that should happen before this scene is popped or another scene is pushed on top */
};

StoryViewAssistant.prototype.cleanup = function(event) {
    //HERE, OK?
    this.controller.stopListening("nextStore", Mojo.Event.tap, this.nextStoryHandler);
};

Thanks in advance


Source: (StackOverflow)

Maven: How can my mojo access its own resources?

I have a project (here called my-artifact) which needs to generate sources from a model file. I've created a maven-plugin (my-code-generator) which is used as described in the pom.xml excerpt below. It loads and processes the model.xml from my-artifact's resources and generates code using some predefined templates stored within the plugin. The question is how my-code-generator could access these templates as they are not in the project resources but within its own resources.

Thanks in advance

<plugin>
  <groupId>my-group</groupId>
        <artifactId>my-code-generator</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <configuration>
                <modelfile>
                        src/main/resources/model.xml
                </modelDir>
        </configuration>
        <executions>
                <execution>
                        <phase>generate-sources</phase>
                        <goals>
                                <goal>generate-model</goal>
                        </goals>
                </execution>
        </executions>
</plugin>
<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
                <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                                <goal>add-source</goal>
                                <sources>
                                        <source>target/generated-sources</source>
                                </sources>
                        </configuration>
                </execution>
        </executions>
</plugin>


Source: (StackOverflow)

Maven Plugin Logger Compatibility

I am writing a Maven plugin (Mojo) that imports a Jar library used by other projects. At least one of the classes in that library use Apache Log4j for logging, but Log4j is not going to be properly configured by the logger that Maven provides to the Mojo.

Is there any simple way to bridge between these? Unfortunately, org.apache.log4j.Logger and org.apache.maven.logging.Log do not share a common superinterface or superclass, so I can't simply have a setLog() type function. Any suggestions would be welcome; currently I am planning to either just ignore it, or write a bridge class that can use either.


Source: (StackOverflow)

Mojo::DOM - XPath - Question

Why did the Mojo::DOM developers create their own Selectors and not use the XPath syntax?


Source: (StackOverflow)

Can't post json in a Mojo::UserAgent request

I can't get the following Mojo::UserAgent call to post JSON to the server:

use Mojo::UserAgent;
my $ua=Mojo::UserAgent->new;
my $json = $ua->post("localhost:6767" => {} => json =>{ val=>10 })->res->json;

Using a fake debug server on the other side with nc -l 6767 gives the following output:

POST / HTTP/1.1
User-Agent: Mojolicious (Perl)
Connection: keep-alive
Content-Length: 0
Host: localhost:6767 

It's not just the json method, the form, and the whole Transactor seems to be broken on 2 of my machines. From the docs:

perl -MMojo::UserAgent::Transactor -E 'say Mojo::UserAgent::Transactor->new->tx(PUT => "http://kraih.com" => json => {a => "b"})->req->to_string;'
PUT / HTTP/1.1
Content-Length: 4
Host: kraih.com

json

Hard to believe my eyes. What am I missing?


Source: (StackOverflow)

How to add and remove routes dynamically in Mojolicious?

I am trying to put together a maintenance page in my Mojolicious app which all of my users will be shown whenever a file or DB entry is present on the server.

I know I can check for this file or entry on startup and if its there add in my 'catch all' route. However I'm not sure how to do this dynamically? I don't want to have to restart the backend whenever I want to go into maintenance.

Is there a way to add and remove routes from a hook? for example use the before dispatch hook to monitor for the file/db entry and if it exists modify the routes?

I tried this but I didn't seem to be able to access the routes from the hooked function, only in the startup function.

Thank you.


Source: (StackOverflow)

Maven: How to get all transitive dependencies programatically in a MOJO [duplicate]

Possible Duplicate:
How to get access to Maven’s dependency hierarchy within a plugin.

The dependency:tree plugin:goal has an option 'verbose' which displays all conflicts & duplicates in the dependency tree. I am trying to reuse that information in my own mojo to generate reports, however - I can't seem to figure out exactly how that plugin is gathering all transitive dependencies\artifacts.

I've tried:

ArtifactResolutionResult result = _artifactCollector.collect( _project.getDependencyArtifacts(), _project.getArtifact(), _project.getManagedVersionMap(),
    		_localRepository, _project.getRemoteArtifactRepositories(), _artifactMetadataSource, null, Collections.EMPTY_LIST );

As far as I can tell this is how the tree goal is doing it with the exception of the listener.

Does anyone out there know how to do what I am asking?

UPDATE: I didn't search well enough apparently, my question is a duplicate of: this. Please vote to close as I have already done, thanks.


Source: (StackOverflow)

Generate jaxb Xsd schema for class files from a jar

I would like to generate jaxb xsd schema from class files in jar. Currently, I am using jaxb2-maven-plugin to generate schema using java files.

<plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jaxb2-maven-plugin</artifactId>
        <version>${maven.plugin.jaxb2}</version>
        <executions>
           <execution>
              <id>schemagen</id>
              <goals>
                 <goal>schemagen</goal>
              </goals>
              <phase>process-classes</phase>
              <configuration>
                 <quiet>true</quiet>
                 <includes>
                    <include>com/someProject/domain/*.java</include>
                 </includes>
                 <outputDirectory>${project.build.directory}/schemas</outputDirectory>
                 <clearOutputDir>true</clearOutputDir>
              </configuration>
           </execution>
        </executions>
     </plugin>

But, I have a use case where I am getting a dependency jar file and would like to generate out of some classes from that jar file. Can anyone suggest how can it be done.


Source: (StackOverflow)