小编Ang*_*chs的帖子

如何使Maven EAR插件自动管理依赖项的类路径?

我大约12个月前开始使用maven ear插件,想知道是否有其他选择.Maven的一个好处是依赖管理,但你似乎几乎完全失去了耳塞.它将所有依赖的jar构建到耳朵中,但实际上不会将它们中的任何一个放在类路径上而不添加以下配置:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-ear-plugin</artifactId>
    <version>2.4</version>
    <configuration>
        <version>6</version>
        <modules>
            <ejbModule>
                <groupId>com.mycompany.app</groupId>
                <artifactId>MyApplication-ejb</artifactId>                          
            </ejbModule>

            <jarModule>
                <groupId>axis</groupId>
                <artifactId>axis</artifactId>
                <bundleDir>lib</bundleDir>
            </jarModule>
            <jarModule>
                <groupId>commons-discovery</groupId>
                <artifactId>commons-discovery</artifactId>
                <bundleDir>lib</bundleDir>
            </jarModule>
            <jarModule>
                <groupId>axis</groupId>
                <artifactId>axis-wsdl4j</artifactId>
                <bundleDir>lib</bundleDir>
            </jarModule>
        </modules>
    </configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)

我错过了一些更新版本的插件消除了对此的需求,是否有替代方案可以为您管理?我无法相信每次向模块添加依赖项时我需要将其添加到耳塞配置中.最令人沮丧的是,即使我记得在上面的配置中添加一个依赖库,如果它依赖于其他东西(就像轴的情况一样),我只是在部署耳朵时才发现.

ear maven-plugin maven maven-ear-plugin

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

通过静态子句元素改进LIKE子句

我很好奇是否LIKE可以使用静态子句元素来优化使用子句.

这是查询吗?

(SELECT * FROM n where n.name = 'x' AND n.body LIKE '%x%';)
Run Code Online (Sandbox Code Playgroud)

比这更快

(SELECT * FROM n WHERE n.body LIKE '%x%';)
Run Code Online (Sandbox Code Playgroud)

我用的是mysql.

mysql sql performance

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

如何在Java中将JSONObject写入其中包含JSONArray的文件?

我有JSON文件,我需要再次阅读,编辑和写出.

阅读工作正常,我在数据中与JSON数组的写入部分斗争.

我使用JSON.simple库来处理Java中的JSON.

该文件如下所示:

{
    "maxUsers":100,
    "maxTextLength":2000,
    "maxFileSize":2000,
    "services":
    [
        {
            "serviceName":"?????c",
            "className":"YandexConnector.class",
            "isEnabled":true
        },

        {
            "serviceName":"Google",
            "className":"GoogleConnector.class",
            "isEnabled":false
        }
    ]
}
Run Code Online (Sandbox Code Playgroud)

当我尝试将JSON数据(变量obj)写入文件时,该services数组被破坏.我的写作代码:

JSONObject obj = new JSONObject();
obj.put("maxUsers", this.getMaxUsers());
obj.put("maxTextLength", this.getMaxTextLength());
obj.put("maxFileSize", this.getMaxFileSize()); 

JSONArray servicesJSON = new JSONArray();
ArrayList<Service> servicesArray = this.getServices();
for(int i=0; i< servicesArray.size(); i++)
{
    servicesJSON.add(servicesArray.get(i));
}
obj.put("services", servicesJSON);


FileWriter file = new FileWriter(filename);                
obj.writeJSONString(file);
file.flush();
file.close();
Run Code Online (Sandbox Code Playgroud)

这输出:

{
    "services":
    [
        translator.settings.Service@121c5df,
        translator.settings.Service@45f4ae
    ],
    "maxTextLength":2000,
    "maxUsers":100,
    "maxFileSize":2000
}
Run Code Online (Sandbox Code Playgroud)

如何将JSON数据正确地写入文件,如果我在JSONArray中这样做services …

java json json-simple jsonobject

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

SQL从列末尾删除部分字符串

我知道每一栏的结尾

让我们说它"马铃薯"

有没有办法,从每一栏中删除"马铃薯"

我知道

CONCAT添加到一个列,但如果我知道那里有什么,我如何从最后删除

mysql sql truncate

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

字符串中的数字?

我正在制作一个超级简单的BMI计算器,你可能会说我是Javascript的新手.这是我到目前为止在我的HTML和Javascript文件中所拥有的.我在这里错过了什么来提醒答案?我知道问题出在Javascript的某个地方; 我错过了什么.谢谢.

<!doctype html>
<html>
   <head>
      <meta charset="utf-8">
      <title>BMI Calculator</title>
   </head>
   <body>
      <h1> BMI Calculator</h1>
      <form action="" method="get" id="bmi-form">
         <div class=section">
            <label for="q">Enter Weight in Pounds</label>
            <input type="search" id="weight" name="weight" required placeholder="type your weight">
            </br>
            <label for="h">Enter your Height in Inches</label>
            <input type="search" id="height" name="height" required placeholder="type your height">
         </div>

         <div class="button-group">
            <button type="submit" id="btn">Check</button>
         </div>
      </form>

      <div id="output"></div>
      <script src="javascript1.js"></script>
   </body>
Run Code Online (Sandbox Code Playgroud)

JS:

(function() {
   var btn = document.getElementById("btn"),
       bmiForm =document.getElementById("bmi-form"),
       weight = document.getElementById("weight"),
       height = document.getElementById("height");

   btn.onclick = function …
Run Code Online (Sandbox Code Playgroud)

javascript

-12
推荐指数
1
解决办法
424
查看次数