小编Ric*_*ssu的帖子

Maven antrun:将maven属性传递给ant

我试图将maven属性(通过配置文件定义)传递给antrun执行:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-antrun-plugin</artifactId>
    <version>1.7</version>
    <dependencies>
        <!-- ... these are ok -->
    </dependencies>
    <executions>
        <execution>
            <configuration>
                <target>
                    <property name="ant_destDir" value="${destDir}" />
                    <property name="ant_serverDeploy" value="${serverDeploy}" />
                    <property name="ant_deployDir" value="${deployDir}" />
                    <property name="ant_userDeploy" value="${userDeploy}" />
                    <property name="ant_passwordDeploy" value="${passwordDeploy}" />
                    <!-- correct task definitions for sshexec and scp -->
                    <sshexec host="${serverDeploy}" username="${userDeploy}" 
                            password="${passwordDeploy}" trust="yes" 
                            command="some command" />
                    <scp remoteTodir="${userDeploy}@${serverDeploy}:${destDir}" 
                            password="${passwordDeploy}" trust="yes" sftp="true">
                        <fileset dir="${deployDir}" includes="*.jar" />
                    </scp>
                    <sshexec host="${serverDeploy}" username="${userDeploy}" 
                            password="${passwordDeploy}" trust="yes" 
                            command="some command" />
                </target>
            </configuration>
            <phase>install</phase>
            <goals>
                <goal>run</goal>
            </goals>
        </execution>
    </executions> …
Run Code Online (Sandbox Code Playgroud)

maven maven-antrun-plugin

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

有什么办法让maven scp旅行车在linux/mac/windows平台上保持一致吗?

鉴于关于scp/ssh和maven的文档很差,我尝试了不同的方法,基本上分为两大类:使用scpexe旅行车和scp旅行车.通常它们在linux和mac上都没有问题,但是在Windows上我从来没有找到让它在所有机器上运行的方法.

scpexe方法(安装完成putty并添加到路径后) - settings.xml配置:

<server>
    <id>internal</id>
    <username>******</username>
    <password>*******</password>
    <configuration>
        <sshExecutable>plink</sshExecutable>
        <scpExecutable>pscp</scpExecutable>
    </configuration>
</server>
Run Code Online (Sandbox Code Playgroud)

scp方法 - settings.xml:

 <server>
      <id>internal</id>
      <username>*********</username>
      <password>*********</password>
      <configuration>
           <StrictHostKeyChecking>ask</StrictHostKeyChecking>
      </configuration>
 </server>
Run Code Online (Sandbox Code Playgroud)

我也尝试将StrictHostKeyChecking设置为"no",但是,除了安全风险之外,在特定机器上无效.

有人找到了在所有机器上一致使用内部ssh存储库的方法吗?

java ssh scp jsch maven

9
推荐指数
1
解决办法
8083
查看次数

将数字(22,21)映射到BigDecimal时,Hibernate在结果中的精度损失

我在Oracle 11g中将此列映射为NUMBER(21,20),它在Hibernate中映射为:

@Column(name = "PESO", precision = 21, scale = 20, nullable = false)
public BigDecimal getWeight() {
    return weight;
}
Run Code Online (Sandbox Code Playgroud)

对于列的值为0.493的特定记录,我得到一个BigDecimal,其值为0.49299999999.似乎某些地方由于(可能)Double或Float转换而导致精度损失,但我无法通过这样的简单单元测试来跟踪它:

Double d = new Double("0.493");
System.out.println((d));
Run Code Online (Sandbox Code Playgroud)

该代码的任何变体,使用Float,BigDecimal和各种构造函数都会得到相同的结果:"0.493"...有关如何映射列以避免此类问题的任何提示?我正在使用Hibernate 3.5.6,带有JPA注释和Hibernate API(即Session而不是EntityManager)

java oracle double hibernate bigdecimal

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

标签 统计

java ×2

maven ×2

bigdecimal ×1

double ×1

hibernate ×1

jsch ×1

maven-antrun-plugin ×1

oracle ×1

scp ×1

ssh ×1