小编Sci*_*ist的帖子

在pom.xml中指定目标

我正在创建一个新的maven项目,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/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>firstRestlet</groupId>
  <artifactId>restlet1</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>

  <name>restlet1</name>
  <url>http://maven.apache.org</url>
  <repositories>
<repository>
   <id>maven-restlet</id>
   <name>Public online Restlet repository</name>
   <url>http://maven.restlet.org</url>
</repository> 
</repositories>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>
Run Code Online (Sandbox Code Playgroud)

我面临的问题是目标war文件没有生成.在运行此操作后的eclipse控制台上,我pom.xml发现的是目标缺失pom.xml.

ECLIPSE CONSOLE MESSAGE:

No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, …
Run Code Online (Sandbox Code Playgroud)

java xml eclipse maven

48
推荐指数
6
解决办法
21万
查看次数

LinkedBlockingQueue put vs offer

我有一个链接的阻塞队列,我在其中执行插入和删除操作.

我需要知道哪一个更好put或者offer在链接阻塞队列的情况下.

性能参数是CPU利用率,内存和总吞吐量.

应用程序使用是实时系统,其中可以有多个传入请求和更少的线程来处理我们需要在队列中插入元素的位置.

我读了Java文件的put和offer在内部应用程序中没有太大区别.

java multithreading threadpoolexecutor

15
推荐指数
1
解决办法
9643
查看次数

哪个更好LinkedBlockingQueue无界或LinkedBlockingQueue与容量

我在ThreadPoolExecutor中使用LinkedBlockingQueue作为工作队列.问题是我应该使用有界LinkedBlockingQueue或无界LinkedBlockingQueue.我已经覆盖了ThreadPoolExecutor的execute方法,并且在核心池大小之后不再面临线程创建的问题.

所以请告诉我使用LinkedBlockingQueue有界或无界哪个更好.

谢谢,Tushar

java queue multithreading threadpoolexecutor

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

不同类型集合的集合重载

我知道重载是在编译时决定的,但是当我尝试运行下面的示例时,它给出的结果是我无法理解的

package miscellaneous;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class CollectionsOverloading {

public static String classify(Set<?> s) {
    return "Set";
}

public static String classify(List<?> s) {
    return "List";
}

public static String classify(Collection<?> s) {
    return "Collection";
}

public static void main (String args[]) {

    Collection<?>[] collections = { new HashSet<String>(), new ArrayList<String>(), new HashMap<String, String>().values()};

    for (Collection<?> coll : collections) {
        System.out.println(classify(coll));
    }
    }
}
Run Code Online (Sandbox Code Playgroud)

当我每次运行此代码片段时,我都会得到“Collection”输出,这意味着调用了参数为 Collection 的分类方法。

请解释

java collections overloading

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