小编Ada*_*wka的帖子

Maven:在pom.xml中配置并行构建

Maven有能力执行并行构建:https: //cwiki.apache.org/confluence/display/MAVEN/Parallel+builds+in+Maven+3

mvn -T 4 clean install # Builds with 4 threads
mvn -T 1C clean install # 1 thread per cpu core
mvn -T 1.5C clean install # 1.5 thread per cpu core
Run Code Online (Sandbox Code Playgroud)

是否可以在pom.xml或settings.xml中指定此参数?重复这个选项可能很烦人.

java maven

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

Eclipse中的JPA项目问题 - 类注释中的错误@Entity:表"xxx"无法解析

我正在尝试在Eclipse(Indigo)中创建简单的EJB + JPA项目.我创建了新的EJB项目,其中:

  • 目标:现有的Glassfish服务器
  • 配置:EJB模块+ GlassFish部署描述符文件+ Java + JPA在窗口JPA Facet我声明连接到postgres db(ping成功)

我在尝试定义实体时遇到问题:表"Employee"无法解析.我添加了带有指定名称参数的@Table注释,但这不起作用.我的persistence.xml文件:

    <persistence-unit name="pu_name">
    <jta-data-source>jdbc/baza1Postgres</jta-data-source>
</persistence-unit>
Run Code Online (Sandbox Code Playgroud)

在glassfish中,我定义了名为JDBC资源的JDBC资源:"jdbc/baza1Postgres
"如果我的表存在,"eclipse如何知道"?还有什么我应该配置?

eclipse postgresql ejb jpa glassfish

10
推荐指数
3
解决办法
4万
查看次数

Spring JDBC + Postgres SQL + Java 8 - 从/到LocalDate的转换

我正在使用Postgres SQL 9.2,Spring JDBC版本4.0.5和Java 8.
Java 8引入了新的日期/时间API,我想使用它,但是我遇到了一些困难.我创建了表TABLE_A:

CREATE TABLE "TABLE_A"
(
  new_date date,
  old_date date
)
Run Code Online (Sandbox Code Playgroud)

我正在使用Spring JDBC与数据库进行通信.我创建了Java类,它对应于这个表:

public class TableA
{
    private LocalDate newDate;
    private Date oldDate;
    //getters and setters

}
Run Code Online (Sandbox Code Playgroud)

这是我的代码,它可以插入新行:

public void create(TableA tableA)
{
    BeanPropertySqlParameterSource parameterSource = new BeanPropertySqlParameterSource(tableA);
    final String sql = "INSERT INTO public.TABLE_A (new_date,old_date) values(:newDate,:oldDate)";
    namedJdbcTemplate.update(sql,parameterSource);

}
Run Code Online (Sandbox Code Playgroud)

当我执行这个方法时,我得到了异常:

org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of java.time.LocalDate. Use setObject() with an explicit Types value to specify the type to …
Run Code Online (Sandbox Code Playgroud)

java postgresql spring spring-jdbc java-8

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

Spring 4无法执行Java 8默认方法

我已定义界面

public interface MyInterface {
  default void setOrder(int a){ }
  default int getOrder(){return 123;}
}
Run Code Online (Sandbox Code Playgroud)

和实施

public class MyInterfaceImpl implements MyInterface {}
Run Code Online (Sandbox Code Playgroud)

在我的spring配置文件中,我定义了以下bean:

    <bean id="a" class="my.package.MyInterfaceImpl">
    <property name="order" value="999"/>
</bean>
Run Code Online (Sandbox Code Playgroud)

当我创建spring上下文时,我遇到以下错误:

Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'order' of bean class [my.package.MyInterfaceImpl]: Bean property 'order' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Run Code Online (Sandbox Code Playgroud)

我在版本4.1.6.RELEASE中使用spring.所以我的问题是为什么不可能从接口MyInterface执行默认方法setOrder?看来春天完全忽略了这样的方法.

spring java-8 spring-4

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

Gcloud - 无法使用一个服务帐户配置多个虚拟机

我正在使用 Gcloud 运行 Prow(持续集成服务器)。我的工作之一是创建一个虚拟机,执行一些测试,然后删除该实例。我使用服务帐户来创建虚拟机,运行测试。

#!/bin/bash

set -o errexit

cleanup() {
    gcloud compute instances delete kyma-integration-test-${RANDOM_ID}
}


gcloud config set project ...
gcloud auth activate-service-account --key-file ...

gcloud compute instances create <vm_name> \
    --metadata enable-oslogin=TRUE \
    --image debian-9-stretch-v20181009 \
    --image-project debian-cloud --machine-type n1-standard-4 --boot-disk-size 20 \

trap cleanup exit

gcloud compute scp --strict-host-key-checking=no --quiet <script.sh> <vm_name>:~/<script.sh>

gcloud compute ssh --quiet <vm_name> -- ./<script.sh>
Run Code Online (Sandbox Code Playgroud)

一段时间后,我收到以下错误:

ERROR: (gcloud.compute.scp) INVALID_ARGUMENT: Login profile size exceeds 32 KiB. Delete profile values to make additional space.
Run Code Online (Sandbox Code Playgroud)

事实上,对于该服务帐户, …

cloud google-cloud-platform gcloud google-iam

5
推荐指数
2
解决办法
4237
查看次数