小编Mat*_*uis的帖子

Maven错误消息Artifact没有文件

我的构建中收到了大量的这些错误消息.但是它似乎对传递或失败构建没有影响.有谁知道它来自哪里?

编辑 - >它似乎与报告插件有关.这就是报告部分的全部内容

<reporting>
    <plugins>
        <plugin>
            <!-- use mvn cobertura:cobertura to generate cobertura reports -->
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>cobertura-maven-plugin</artifactId>
            <version>2.5.2</version>
            <configuration>
                <formats>
                    <format>html</format>
                    <format>xml</format>
                </formats>
                <check/>
            </configuration>
        </plugin>
    </plugins>
</reporting>
Run Code Online (Sandbox Code Playgroud)

这是我的插件

<plugins>
    <!-- fixes bug running coverage for jdk 1.7 -->
    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.12</version>
        <configuration>
            <argLine>-XX:-UseSplitVerifier</argLine>
        </configuration>
    </plugin>
    <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <inherited>true</inherited>
        <configuration>
            <source>1.7</source>
            <target>1.7</target>
            <encoding>UTF-8</encoding>
        </configuration>
    </plugin>
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>cobertura-maven-plugin</artifactId>
        <version>2.4</version>
        <configuration>
            <check>
                <branchRate>100</branchRate>
                <lineRate>100</lineRate>
                <haltOnFailure>true</haltOnFailure>
                <totalBranchRate>100</totalBranchRate>
                <totalLineRate>100</totalLineRate>
                <packageLineRate>100</packageLineRate>
                <packageBranchRate>100</packageBranchRate>
                <!--<regexes>-->
                <!--<regex>-->
                <!--<pattern>com.example.reallyimportant.*</pattern>-->
                <!--<branchRate>90</branchRate>-->
                <!--<lineRate>80</lineRate>-->
                <!--</regex>-->
                <!--<regex>-->
                <!--<pattern>com.example.boringcode.*</pattern>-->
                <!--<branchRate>40</branchRate>-->
                <!--<lineRate>30</lineRate>--> …
Run Code Online (Sandbox Code Playgroud)

java maven-3 maven

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

使用p:calendar在jsf h:datatable中进行交叉字段验证

我注意到这个问题被问到了,但是没有正确回答.

我有一个数据表,有两列开始日期结束日期.两者都包含primefaces p:日历控件.我需要确保对于每一行,column1中的日期不在column2中的日期之后.我想把它绑定到JSF验证框架,但我遇到了麻烦.

我已经尝试将数据表标记为rowStatePreserved ="true",这允许我获取值,但是仍然存在错误,因为当它失败时,第一行中的所有值都会覆盖所有其他值.我做错了什么,或者我应该采用完全不同的策略?

xhtml代码

    <h:form>
 <f:event type="postValidate" listener="#{bean.doCrossFieldValidation}"/>
       <p:dataTable id="eventDaysTable" value="#{course.courseSchedules}" var="_eventDay" styleClass="compactDataTable"
                                 >
                        <p:column id="eventDayStartColumn">
                            <f:facet name="header">
                                Start
                            </f:facet>
                            <p:calendar id="startDate" required="true"  value="#{_eventDay.startTime}" pattern="MM/dd/yyyy hh:mm a"/>
                        </p:column>
                        <p:column id="eventDayEndColumn">
                            <f:facet name="header">
                                End
                            </f:facet>
                            <p:calendar id="endDate" required="true"  value="#{_eventDay.endTime}" pattern="MM/dd/yyyy hh:mm a"/>
                        </p:column>                                        
                    </p:dataTable>
        </h:form>
Run Code Online (Sandbox Code Playgroud)

验证码

 public void doCrossFieldValidation(ComponentSystemEvent cse) {


        UIData eventsDaysStable = (UIData) cse.getComponent().findComponent("eventDaysTable");

        if (null != eventsDaysStable && eventsDaysStable.isRendered()) {

            Iterator<UIComponent> startDateCalendarIterator = eventsDaysStable.findComponent("eventDayStartColumn").getChildren().iterator();
            Iterator<UIComponent> endDateCalendarIterator = eventsDaysStable.findComponent("eventDayEndColumn").getChildren().iterator();

            while (startDateCalendarIterator.hasNext() && endDateCalendarIterator.hasNext()) …
Run Code Online (Sandbox Code Playgroud)

java jsf primefaces jsf-2

11
推荐指数
1
解决办法
4276
查看次数

使用Hibernate更新具有瞬态对象的持久对象

每天,数据通过Web服务导入.

  1. 我创建了一个pojo 的新(瞬态)实例,我通过JPA注释在hibernate中映射.
  2. 我将Web服务中的数据填充到瞬态实例中
  3. 我从我想要使用瞬态实例中的数据更新的数据库中加载持久对象.
  4. 我以某种方式将这个瞬态实例与持久实例合并.如果持久对象在其中一个字段上具有非空值,则它不会被瞬态对象上的潜在空值覆盖.基本上我不想丢失任何数据,只是更新事情发生了变化.

我知道我可以浏览pojos上的所有字段,并检查空值,并在适当的地方更新,但我更愿意让hibernate执行此操作,如果它能够,因为它会减少我添加字段和忘记将其添加到此手动合并过程中.

休眠可以执行上面的第4步吗?

java hibernate jpa

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

无法让 Spring MVC 使用 DateTimeFormat 注释解析日期时间

我想在休息服务中使用路径参数作为完整的 ISO 时间戳。

http://domain:8080/ctx/someObj/2000-10-31 01:30:00.000-05:00
Run Code Online (Sandbox Code Playgroud)

我以前打开了 mvc:annotation 驱动,但将其关闭,以便我可以在 DefaultAnnotationHandlerMapping 上将“useDefaultSuffixPattern”设置为 false。

控制器代码

@RequestMapping(value = "/lwc/{userMidnightTime}", method = RequestMethod.GET)
@ResponseBody
public List<ProgramSnippetView> getLiveWebcastsWithin24HoursOfTime(@PathVariable(value = "userMidnightTime") @DateTimeFormat(iso= DATE_TIME) Date userMidnightTime) {
    Calendar cal = new GregorianCalendar();
    cal.setTime(userMidnightTime);
    cal.add(Calendar.HOUR, 24);
    Date endTime = cal.getTime();
    return programService.getLiveWebcastSnippetsWithProductionDateInRange(userMidnightTime, endTime);
}
Run Code Online (Sandbox Code Playgroud)

我收到以下错误。我可以看到框架最终使用正确的字符串调用了已弃用的 Date.parse() 方法,而不是使用 joda 时间来完成这项工作。

112977 [http-apr-8080-exec-7] DEBUG org.springframework.beans.BeanUtils - No property       editor [java.util.DateEditor] found for type java.util.Date according to 'Editor' suffix convention
117225 [http-apr-8080-exec-7] DEBUG org.springframework.beans.TypeConverterDelegate - Construction via String failed for type [java.util.Date] …
Run Code Online (Sandbox Code Playgroud)

java rest spring spring-mvc jodatime

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

Internet Explorer开发人员工具不使用RequireJS显示源代码

我正在尝试调试一个页面问题,其中IE 9将首次在我的requirejs/backbone应用程序上运行,但会在页面重新加载时失败.但是,当我尝试使用f12 IE开发人员工具调试此问题时,我无法导航到源设置断点,因为IE不会加载RequireJS包含的任何文件.我如何解决这个问题来解决我的IE问题?

javascript internet-explorer amd requirejs

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

将自定义端点添加到Spring OAuth2授权服务器

我有兴趣向我的OAuth2授权服务器添加自定义的休息端点。

我想添加一个注册终结点,我的UI资源服务器可以调用该注册终结点,注册用户,并一次性收回所有令牌(注册时自动登录)。

我可以在两个请求中进行此操作,因为UI资源服务器具有用户的密码,但是我更愿意在一个请求中进行操作,因为我正在重新使用授权服务器来存储我的所有用户凭据。

我创建了一个端点

@FrameworkEndpoint
class RegistrationController {

  @Autowired
  LocalUserAuthenticationService userDetailsService

  @Autowired
  TokenEndpoint tokenEndpoint

  @RequestMapping(value = "/registration", method = RequestMethod.POST)
  @ResponseStatus(HttpStatus.CREATED)
  public ResponseEntity<OAuth2AccessToken> registerUser(Principal principal,
                                                        @RequestBody @Valid RegistrationRequest registrationRequest) {
    userDetailsService.register(registrationRequest.email, registrationRequest.password)
    return tokenEndpoint.getAccessToken(principal, [grant_type: 'password', username: registrationRequest.email, password: registrationRequest.password])
  }
}
Run Code Online (Sandbox Code Playgroud)

我在我的上下文中注册

@EnableAuthorizationServer
public class AuthServerConfig {

@Bean
public RegistrationController(){
   return new RegistrationController()
} ... more
}
Run Code Online (Sandbox Code Playgroud)

但是,以这种方式使用请求时,始终是未经授权的。它说找不到用户。它可以解析基本的身份验证凭据,但是尽管在此上下文中注册了该bean,但无论在哪里寻找它们都找不到它们。

@FrameworkEndpoint的文档说

Use with @RequestMapping and all the other @Controller features (and match with a FrameworkEndpointHandlerMapping in the servlet context)
Run Code Online (Sandbox Code Playgroud)

但我似乎无法破解如何真正做到这一点。或者如果我误会了。

我怎样才能正确地注册它,使其像其他框架bean一样工作?

spring spring-security spring-boot spring-security-oauth2 spring-oauth2

5
推荐指数
0
解决办法
1186
查看次数

apache httpclient内容长度问题

我试图使用Apache Httpclient将一些JSON发布到休息服务.但是,我收到此错误:

    Exception in thread "main" org.apache.http.ProtocolException: Content-Length header already present
Run Code Online (Sandbox Code Playgroud)
UsernamePasswordCredentials defaultcreds = new UsernamePasswordCredentials(USER,
            PASS);


    HttpHost targetHost = new HttpHost("localhost", 8080, "http");

    DefaultHttpClient httpclient = new DefaultHttpClient();

    httpclient.getCredentialsProvider().setCredentials(
            new AuthScope(targetHost.getHostName(), targetHost.getPort()),
            new UsernamePasswordCredentials(USER, PASS));


    HttpPost httpPost = new HttpPost(urlSuffix) {};

    JSONObject holder = new JSONObject();
    holder.put("name", "this is a folder");


    StringEntity se = new StringEntity(holder.toString());

    httpPost.setHeader("Accept", "application/json");
    httpPost.setHeader("Content-type", "application/json");
    httpPost.setEntity(se);



    HttpResponse resp = httpclient.execute(targetHost,httpPost);

    System.out.println("Resp->" + resp.getStatusLine().getStatusCode());
Run Code Online (Sandbox Code Playgroud)

我读过它因为我已经设置了两次内容长度,但我不确定如何解决它.

java rest apache-httpclient-4.x

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

Spring mvc控制器jsr 303基本列表验证

我有一个简单的MVC控制器,它接收一个电子邮件列表,然后会向这些电子邮件发送一条消息.

json POST身体

{"emailAddresses" : []} 
Run Code Online (Sandbox Code Playgroud)

@RequestMapping(value = "/{id}/share", method = RequestMethod.POST)
@ResponseBody
public void shareThing(@PathVariable(value = "id") final String id, @Valid @NotEmpty       @RequestBody  final List<String> emailAddresses)
Run Code Online (Sandbox Code Playgroud)

基本上,我想使用jsr-303,这样如果客户端发布没有电子邮件的请求,它就会失败.最好是401.

上述代码应该有效吗?或者我需要做什么?这是设置.Hibernate验证器在类路径上,因此它应该正常运行.但是,如果我发布一个空的json数组,它会直接进入方法,并将一个空数组列表作为绑定参数.

@Configuration
@EnableWebMvc
@ComponentScan(basePackages = {"com.package.thing"})
public class WeConfiguration extends WebMvcConfigurerAdapter
Run Code Online (Sandbox Code Playgroud)

json POST身体

{"emailAddresses" : []} 
Run Code Online (Sandbox Code Playgroud)

@RequestMapping(value = "/{id}/share", method = RequestMethod.POST)
@ResponseBody
public void shareThing(@PathVariable(value = "id") final String id, @Valid @NotEmpty          @RequestBody  final List<String> emailAddresses, BindingResult bindingResult)
{
    System.out.println("Has Errors? " + bindingResult.hasErrors();
}
Run Code Online (Sandbox Code Playgroud)

产量

有错误吗?假

试验3,改变有效载荷,工作......但我没有看到需要包装?

public …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc bean-validation

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