小编hai*_*hui的帖子

为单个Jenkins作业构建多个Maven配置文件

我正在尝试在单个Jenkins作业中构建多个Maven配置文件.每个配置文件修改一些代码,然后通过执行创建一个罐子mvn -Pdev install,然后mvn -Pprod install在命令行中(根据使用Maven mvn -Pdev,prod install应该工作,但它不工作对我来说).以下是我项目中的两个配置文件pom.xml:

<profiles>   
 <!-- prod profile -->
   <profile>
    <id>prod</id>
     <build>
      <plugins> 

          <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>replacer</artifactId>
                <version>1.5.2</version>

                <executions>
                    <execution>                    
                        <phase>process-resources</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                    </execution>
                </executions>

                <configuration>

                         <file>src/main/java/com/IQzone/android/configuration/AbstractHoldingRefreshable.java</file>
                    <replacements>
                        <replacement>
                            <token>TrUe</token>
                            <value>TOAST_SWITCH</value>
                        </replacement>
                    </replacements>

                </configuration>

            </plugin>

         <plugin>
           <artifactId>maven-jar-plugin</artifactId>
           <executions>
             <execution>
               <phase>package</phase>
               <goals>
                 <goal>jar</goal>
               </goals>
               <configuration>
                 <classifier>prod</classifier>
               </configuration>
             </execution>
           </executions>
         </plugin>
       </plugins>
     </build>
   </profile>


 <!-- dev profile -->
   <profile>
     <id>dev</id>
     <build>
        <plugins>

            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>replacer</artifactId>
                <version>1.5.2</version>

                <executions>
                    <execution>                    
                        <phase>process-resources</phase>
                        <goals>
                            <goal>replace</goal> …
Run Code Online (Sandbox Code Playgroud)

build artifactory maven jenkins

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

HtmlUnit关闭所有windows内存泄漏

HtmlUnit似乎不会关闭webclient中的窗口,从而造成内存泄漏.我正在尝试使用HtmlUnit获取一个页面并将其传递给JSoup进行解析.我知道JSoup可以连接到一个页面,但我需要使用这种方法,因为我需要在解析它们之前在某些站点上保持登录会话.

这是代码:

import java.io.IOException;
import java.net.MalformedURLException;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

import com.gargoylesoftware.htmlunit.BrowserVersion;
import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.HtmlPage;

public class HtmlUnitLeakTest {

public static void main(String args[]) throws FailingHttpStatusCodeException, MalformedURLException, IOException{

        WebClient webClient = new WebClient(BrowserVersion.CHROME);
        webClient.getOptions().setPrintContentOnFailingStatusCode(false);
        webClient.getOptions().setThrowExceptionOnFailingStatusCode(false);
        webClient.getOptions().setThrowExceptionOnScriptError(false);
        webClient.getOptions().setJavaScriptEnabled(true);
        webClient.getOptions().setCssEnabled(false);

        for(int i = 0; i < 500; i++){
            HtmlPage page = webClient.getPage("http://www.stackoverflow.com");
            Document doc = Jsoup.parse(page.asXml());
            webClient.closeAllWindows();
            System.out.println(i);
            if((i % 5 == 0)){
                System.out.println(i);
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

随着这个运行,内存不断攀升,在我的调试屏幕中,我可以看到所有窗口仍然在webclient下被引用而未关闭.

我已经看到这个代码是假设关闭这些窗口:

List<WebWindow> windows = webclient.getWebWindows();
for (WebWindow ww : windows) …
Run Code Online (Sandbox Code Playgroud)

java memory-leaks htmlunit

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

BigQuery - 将 "" 设置为 Null

我得到 csv 文件,其中字符串空值表示为"",当我将文件加载到BigQuery该字段的值是空字符串而不是Null.

有没有办法将 BigQuery 设置""Null值?

google-bigquery

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

Spring中更新多个数据库行-Mybatis

我正在尝试更新多个数据库行。使用mybatis 3.1spring 3 这里是我的更新查询mapper.xml

<update id="updateEmployeeTrips" parameterType="com.xxx.xxx.EmployeeTrip">
    <foreach collection="list" item="employeeTrips" index="index" separator=";">
        update employee_trips set pickup_drop_time = #{employeeTrips.pickupTime} where id = #{employeeTrips.id}
    </foreach>
</update>
Run Code Online (Sandbox Code Playgroud)

给出错误:

您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,了解在第 3 行的 'update employee_trips set pick_drop_time = '01:35:00' where id = 10' 附近使用的正确语法

spring-mvc mybatis spring-mybatis

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