mojo

Maven mojo plugin, how to define phases that must be triggered before this goal?

╄→гoц情女王★ 提交于 2019-12-13 02:14:39
问题 hey, I have a deploy pojo plugin (deploying a war to a remote server). I have the remote-deploy plugin in the build section of pom definition, I need package phase to be triggered before deploy-remote goal, for it the war be already created before I secure-copy it to a remote server. With the execution elements (according to a documentation), I can attach my goal to a particular phase, for instance bind it to the phase after, so in my case, install phase ...but that's just a workaround.

Output command to socket without buffering using Mojo::IOLoop

戏子无情 提交于 2019-12-12 21:03:08
问题 How to do continiously output of command (for me it's long ping) in real-time mode on Mojo server? I'm looking for some example on Mojo::IOLoop. For example, client connects to server and requests for ping X.X.X.X, server returns an non-buffered output (while ping on server return each line to output, client receive this line from socket), after that — server must drop the connection. 来源: https://stackoverflow.com/questions/3171833/output-command-to-socket-without-buffering-using-mojoioloop

Custom type converter for Mojo configuration?

戏子无情 提交于 2019-12-11 07:12:04
问题 I need to use custom type, e.g., LunarDate , in my Mojo object: class MyMojo extends AbstractMojo { /** @parameter */ LunarDate lunarDate; } And I want to configure the parameter in <configuration> section in pom.xml. <configuration> <lunarDate>丁丑年二月初四</lunarDate> </configuration> (The type LunarDate is just an example to illustrate the question) I've already had the type converters, but how to enable them? 回答1: DefaultBeanConfigurator is responsible for using DefaultConverterLookup , and it

Cannot set parameter using annotations on a maven plugin

丶灬走出姿态 提交于 2019-12-10 20:59:31
问题 I'm trying to develop a maven plugin and it does not work when I use @Parameter annotation. My dependencies: ... <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-plugin-api</artifactId> <version>3.2.3</version> </dependency> <dependency> <groupId>org.apache.maven.plugin-tools</groupId> <artifactId>maven-plugin-annotations</artifactId> <version>3.3</version> </dependency> ... When I use: @Parameter (property = "resources") protected String resources; resources are kept as

How to add and remove routes dynamically in Mojolicious?

喜夏-厌秋 提交于 2019-12-10 10:56:30
问题 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

Maven Mojo Mapping Complex Objects

烂漫一生 提交于 2019-12-10 10:19:18
问题 I'm trying to write a maven plugin, including a mapping of a custom class in mvn configuration parameters. Does anybody know how the equivalent class "Person" would look like: http://maven.apache.org/guides/mini/guide-configuring-plugins.html#Mapping_Complex_Objects <configuration> <person> <firstName>Jason</firstName> <lastName>van Zyl</lastName> </person> </configuration> My custom mojo looks like that: /** * @parameter property="person" */ protected Person person; public class Person {

Parallel requests in Mojolicious application

江枫思渺然 提交于 2019-12-09 19:19:43
问题 I have perl application which, for example, parallel searching in google: use Mojo::UserAgent; use Mojo::IOLoop; my $ua = Mojo::UserAgent->new(); my $delay = Mojo::IOLoop->delay(sub { say 'DONE1 (should be before render)'; }); foreach my $i ( 1 .. 10 ) { $delay->begin(); $ua->get("http://www.google.ru/search?q=$i" => sub { say $i; $delay->end(); }); } $delay->wait() unless $delay->ioloop->is_running(); say 'DONE2 (should be before render)'; say 'Found! (render)'; And it's works fine: 6 1 7 10

How to get the current MavenSession or MavenExecutionRequest from a Plexus Component

佐手、 提交于 2019-12-09 07:23:08
问题 I created a Plexus component to house common logic for several Mojos I want to create. I have been able to pass information like localRepository and project from the Mojo (and test cases). I was wondering if there is a way to get the MavenSession or MavenExecutionRequest from within the component without having to pass them as parameters from a Mojo. I know my component will be running from a Maven Mojo. I'm using Maven 2 in this instance. 回答1: I don't believe there is, nor would I think it's

maven插件编写

纵然是瞬间 提交于 2019-12-06 13:01:37
Maven maven作为一个功能丰富的java应用程序管理工具,其提供的插件管理机制为其扩展带来了极大的便利; 本文以统计指定目录下有多少个.java为后缀的文件为例,说明如何自定义maven插件。 Maven插件的命名规范 按照官方建议,maven插件的命名建议为xxxx-maven-plugin,这样命名有两个好处 1、maven-xxxx-plugin为maven官方插件命名,使用这种命名方式可能侵权 2、自定义插件maven执行命令为mvn groupId:artifactId:goal,使用推荐命名方式,maven命令可以简化为mvn xxxx:goal MoJo Maven plain Old Java Object,插件执行目标,一个插件可以包含多个Mojo 创建Mojo工程 1、创建maven工程,选择类型为mojo 2、指定groupId、artifactId、版本号 3、在pom文件中指定打包类型为maven-plugin 4、添加依赖 5、创建mojo实现类,该实现类继承自AbstractMojo 注意这里要通过@Mojo注解指定插件goalPrefix,否则插件无法生成成功 6、mvn clean install生成插件 测试自定义插件 1.创建maven工程 2、执行mvn bale:filestat,看到正常调用自定义Mojo 来源: https:/

perl Mojo and JSON for simultaneous requests

ε祈祈猫儿з 提交于 2019-12-06 07:52:47
问题 I'm usually no Perl coder. However I've got to complete this task. The following code works for me: #!/usr/bin/perl use LWP::UserAgent; use JSON; use strict; my $md5 = $ARGV[0]; $md5 =~ s/[^A-Fa-f0-9 ]*//g; die "invalid MD5" unless ( length($md5) == 32 ); my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 1 }, timeout => 10); my $key="12345...7890"; my $url='https://www.virustotal.com/vtapi/v2/file/report'; my $response = $ua->post( $url, ['apikey' => $key, 'resource' => $md5] );