小编Wor*_*tig的帖子

如何在 Eclipse 中设置 Maven POM 编辑器的格式设置?

当我打开 pom.xml 并Maven POM Editor尝试使用默认快捷方式进行格式化ctrl + shift + f时,我希望该文件被格式化为具有在 中配置的规则的任何其他 .xml Preferences -> XML -> XML Files -> Editor。然而事实并非如此。

Eclipse Version: 2022-03 (4.23.0)
Eclipse Build id: 20220310-1457
Run Code Online (Sandbox Code Playgroud)

我需要打开 pom.xml 来XML Editor代替。Maven POM Editor以自己的方式格式化 pom.xml,我没有在首选项中找到设置。

这是我发现我需要在以下位置打开它XML EditorAutoformat pom.xml without using m2eclipse plugin

Maven POM Editor编辑 pom.xml 时带来了一些功能和优点XML Editor(依赖树、有效的 pom、大纲导航...),我想保留这些功能和优点,但也希望以我的方式完成格式化(使用我选择的设置) 。

有没有办法为 Maven POM 编辑器设置格式设置?

java xml eclipse formatting maven

9
推荐指数
0
解决办法
1878
查看次数

如何正确配置Tomcat SSLHostConfig?

我按照本教程在 tomcat 中启用 ssl:https://medium.com/@raupach/how-to-install-lets-encrypt-with-tomcat-3db8a469e3d2

虽然tomcat最后运行了,但我无法访问https,说无法连接。所以我检查了日志,得到:

Caused by: java.io.IOException: SSLHostConfig attribute certificateFile must be defined when using an SSL connector
Run Code Online (Sandbox Code Playgroud)

,但我的certificateFile 的定义如您所见:

<Connector port="443"
    protocol="org.apache.coyote.http11.Http11NioProtocol"
    maxThreads="100"
    compression="on"
    scheme="https"
    SSLEnabled="true"
    secure="true"
    SSLVerifyClient="none"
    SSLProtocol="TLSv1.2"
    defaultSSLHostConfigName="test.test">
    <SSLHostConfig hostName="test.test">
        <Certificate certificateFile="conf/cert.pem" certificateKeyFile="conf/privkey.pem" certificateChainFile="conf/chain.pem" />
    </SSLHostConfig>
</Connector>
Run Code Online (Sandbox Code Playgroud)

这些文件存在于conf/中

tomcat 9 文档:https://tomcat.apache.org/tomcat-9.0-doc/config/http.html SSLHostConfig 和证书部分

java configuration tomcat ssl-certificate

8
推荐指数
1
解决办法
3万
查看次数

Maven 包括我当前运行的操作系统的 JavaFX 依赖项,即使我对其他操作系统进行分类

我试图仅包含 mac OS 的 JavaFX 依赖项,但仍会下载 win。Linux 部门也是如此。

pom.xml:

<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-graphics</artifactId>
    <version>11.0.2</version>
    <classifier>linux</classifier>
</dependency>
<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-controls</artifactId>
    <version>11.0.2</version>
    <classifier>linux</classifier>
</dependency>
<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-fxml</artifactId>
    <version>11.0.2</version>
    <classifier>linux</classifier>
</dependency>
Run Code Online (Sandbox Code Playgroud)

Maven 部门:

部门

pom.xml:

<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-graphics</artifactId>
    <version>11.0.2</version>
    <classifier>mac</classifier>
</dependency>
<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-controls</artifactId>
    <version>11.0.2</version>
    <classifier>mac</classifier>
</dependency>
<dependency>
    <groupId>org.openjfx</groupId>
    <artifactId>javafx-fxml</artifactId>
    <version>11.0.2</version>
    <classifier>mac</classifier>
</dependency>
Run Code Online (Sandbox Code Playgroud)

Maven 部门:

部门

如何删除 win JavaFX 库或使 Maven 不下载它们?

当我使用 Ubuntu (Linux) 时也会发生同样的情况。当我分类时我想要 mac 库,linux 库也被下载等等。

也许值得注意的是,我在 Windows 和 Ubuntu 上都使用 Eclipse IDE 2021-03。

java javafx maven

7
推荐指数
1
解决办法
2491
查看次数

添加新枚举值时如何避免更改代码的许多部分,从而提供更容易的可扩展性?

我试图让我的代码更容易扩展,因为一点点的改变不会影响其他代码。

我有一个enum MyEnum,其值将来可能会增加。

然后,有一些类保存它的实例,并且许多行为受到该enum的具体值的影响。换句话说,有很多地方我切换了它的值。

public enum MyEnum
{
    FIRST, SECOND, THIRD, FOURTH;
}


public class A
{
    private MyEnum myEnum
    
    public A(MyEnum myEnum)
    {
        this.myEnum = myEnum;
    }
    
    // as you will see, there is a lot of switching over its value
    public void boo()
    {
        switch(myEnum)
        {
            case FIRST: // do smtng
            case SECOND: // do smthing else
            case THIRD: // do smthing else
            case FOURTH: // do nice thing
        }
    }

    public int goo() …
Run Code Online (Sandbox Code Playgroud)

java enums extensibility design-patterns software-quality

6
推荐指数
1
解决办法
520
查看次数

为什么javac目标选项不能低于源选项?

我已经阅读过相关内容sourcetarget选项javac,它们分别定义了我的源代码编译所需的版本和我想要支持的最旧的 JRE 版本。在使用 Maven 构建工具时,我在 pom.xml 中定义了这些参数,如下所示:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.8.1</version>
            <configuration>
                <source>15</source>
                <target>11</target>
            </configuration>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

,但是目标版本不能设置低于源版本,为什么会这样呢?

尝试使用此配置进行编译会导致错误:“编译致命错误:警告:源版本 15 需要目标版本 15”。与源版本高于目标版本的任何其他组合相同。

java javac maven

5
推荐指数
1
解决办法
1431
查看次数

fail2ban - 如何在暂时禁止 3 次后永久禁止 IP

通过本教程在CentOS 8上设置fail2ban服务:https://www.cyberciti.biz/faq/how-to-protect-ssh-with-fail2ban-on-centos-8/

我已经按照上面的教程类似地设置了这样的设置:

[DEFAULT]
# Ban IP/hosts for 24 hour ( 24h*3600s = 86400s):
bantime = 86400
 
# An ip address/host is banned if it has generated "maxretry" during the last "findtime" seconds.
findtime = 1200
maxretry = 3
 
# "ignoreip" can be a list of IP addresses, CIDR masks or DNS hosts. Fail2ban
# will not ban a host which matches an address in this list. Several addresses
# can be defined using space (and/or comma) separator. …
Run Code Online (Sandbox Code Playgroud)

customization centos fail2ban

3
推荐指数
1
解决办法
2万
查看次数

是否可以验证应用程序中的所有 SQL 表达式?

导入项目时,应用程序引用了很多错误的表名,从而导致错误。我需要相应地手动重命名或创建表。如果我只需点击几下就可以找到应用程序中所有错误的 SQL 表达式,那就太好了。

如何验证页面内容正文、页面项等中的所有 SQL 表达式以查看哪些地方存在错误?

编辑:

系列

错误的表

此处:表 SAMPLE$PROJECT_TASKS 不存在,并且 Advisor 未找到。

oracle oracle-apex

3
推荐指数
1
解决办法
96
查看次数