如何抑制/控制Wagon-FTP Maven扩展的日志记录? [英] How to suppress/control logging of Wagon-FTP Maven extension?

查看:110
本文介绍了如何抑制/控制Wagon-FTP Maven扩展的日志记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Wagon-FTP 通过FTP部署Maven站点.工作正常,但输出中充满了FTP连接/身份验证详细信息,可以有效地向所有人公开登录名和密码(特别是如果该项目是开源的,并且其CI协议是可公开访问的):

I'm deploying Maven site by FTP, using Wagon-FTP. Works fine, but output is full of FTP connection/authentication details, which effectively expose logins and passwords to everybody (especially if the project is open source and its CI protocols are publicly accessible):

[...]
[INFO] 
[INFO] --- maven-site-plugin:3.0-beta-3:deploy (default-deploy) @ rempl ---
Reply received: 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 09:08. Server port: 21.
220 You will be disconnected after 15 minutes of inactivity.

Command sent: USER ****

Reply received: 331 User **** OK. Password required

Command sent: PASS ********

Reply received: 230-User **** has group access to: ***
230 OK. Current restricted directory is /
[...]

是否可以禁止此日志记录?或对其进行配置...这是我的pom.xml的一部分,其中使用了Wagon-FTP:

Is it possible to suppress this logging? Or configure it... This is a section of my pom.xml, where Wagon-FTP is used:

[...]
<build>
    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ftp</artifactId>
            <version>1.0-beta-7</version>
        </extension>
    </extensions>
    [...]
</build>
[...]

推荐答案

不可能,基本上与maven站点插件有关,与wagon ftp无关(后者仅是apache-commons-net ftp客户端的简单适配器) ).请参阅

Not possible, and basically it is related to maven site plugin and not the wagon ftp (which is only a simple adapter for the apache-commons-net ftp client). See the source of AbstractDeployPlugin from line 310.

   Debug debug = new Debug();

   wagon.addSessionListener( debug );

   wagon.addTransferListener( debug ); 

恕我直言,一个不错的解决方案是使用Wagon源代码中不需要的更复杂的SessionListener或一个标志来避免addSessionListener(debug).

IMHO the nice solution would be to use a more sophisticated SessionListener or a flag to avoid addSessionListener(debug) if not needed in the Wagon source.

这篇关于如何抑制/控制Wagon-FTP Maven扩展的日志记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆