小编SJu*_*ejo的帖子

Maven部署:使用-DaltDeploymentRepository进行部署

我有maven项目,我想在内部nexus存储库上部署我的工件,该存储库配置为在两个不同的位置上存储我的快照版本.所以我不能使用'distributionManagement',因为这会硬编码位置.所以我定义了几个在我的settings.xml中说'releaseRepository'和'snapshotRepository',每个都有参数'release',对于版本应该设置为'true',对于快照应设置为'false'.

我使用以下命令运行我的构建以释放我的工件;

mvn clean deploy -DaltDeploymentRepository=releaseRepository::<DON'T KNOW WHAT GOES HERE SO LEFT IT EMPTY>::htp://abc.com/repositores/my-releases/ -Drelease=true
Run Code Online (Sandbox Code Playgroud)

现在当我在命令之上运行它失败时因为没有提供'layout'的值而且我得到异常并且构建失败.

我找不到任何关于'layout'应该是什么值的信息,我有大约10个项目,我想要构建并相互发布.

deployment maven

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

jaxws-maven-plugin 2.2 NoSuchMethodError()失败

我正在尝试使用jaxws maven插件为我的Web服务客户端生成源代码并获得以下异常;

    [ERROR] Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.2:wsimport (default) on project cf-wsjavaclient: Error executing: wsimpor
t [-keep, -s, C:\Users\sjunejo\Documents\GitHub\sandbox-ofsconnectorpoc\cf-wsjavaclient\target, -Xnocompile, http://localhost:9090/axis2/services/OFSC
onnectorServiceWS?wsdl]: UndeclaredThrowableException: javax.xml.bind.annotation.XmlElementRef.required() -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.jvnet.jax-ws-commons:jaxws-maven-plugin:2.2:wsimport (default) on p
roject cf-wsjavaclient: Error executing: wsimport [-keep, -s, C:\Users\sjunejo\Documents\GitHub\sandbox-ofsconnectorpoc\cf-wsjavaclient\target, -Xnoco
mpile, http://localhost:9090/axis2/services/OFSConnectorServiceWS?wsdl]
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597) …
Run Code Online (Sandbox Code Playgroud)

jax-ws maven-plugin

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

防止等于方法的存根

我想测试我的类'equals()方法,但Mockito似乎每次调用存根版本.我的测试如下;

PluginResourceAdapter adapter = mock (PluginResourceAdapter.class);
PluginResourceAdapter other = mock (PluginResourceAdapter.class);

when(adapter.getNumberOfEndpointActivation()).thenReturn(1);
when(other.getNumberOfEndpointActivation()).thenReturn(0);

boolean result = adapter.equals(other);
assertFalse(result);
Run Code Online (Sandbox Code Playgroud)

我知道我不能存在equals方法,这意味着Mockito应该调用我真正的实现,但事实并非如此.

我也试过这个:

when (adapter.equals(any()).thenCallRealMethod()
Run Code Online (Sandbox Code Playgroud)

但我得到了相同的结果.

methods equals mocking stub mockito

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

C#Encoding.UTF8弄乱了字节[]

我面临着很奇怪的问题,我有一个字节[],当我路过这Convert.UTF8.GetString(字节[]字节)的方法,系统编码与我搞乱字节和更换只有少数特殊字节(我我在我的系统中使用标记来表示三个字符串表示法.

[0] 70  byte
[1] 49  byte
[2] 45  byte
[3] 86  byte
[4] 49  byte
[5] 253 byte     <-- Special byte
[6] 70  byte
[7] 49  byte
[8] 45  byte
[9] 86  byte
[10]50  byte
[11]253 byte     <-- Special byte
[12]70  byte
[13]49  byte
[14]45  byte
[15]86  byte
[16]51  byte
Run Code Online (Sandbox Code Playgroud)

当我将上面的byte []传递给Encoding.UTF8.GetString(bytes)方法时,我得到以下输出;

private Encoding _encoding = System.Text.Encoding.GetEncoding("UTF-8", new EncoderReplacementFallback("?"), new DecoderReplacementFallback("?"));       
_encoding.GetString(bytes)  "F1-V1?F1-V2?F1-V3" string
Run Code Online (Sandbox Code Playgroud)

实际值不应该为' ',因为这意味着它无法编码并用' '替换那些特殊字节.无论如何我可以解决这个问题,即转换为字符串并将特殊字节表示保留为单个字符.

我有以下特殊字节,我试图用作标记;

byte AM = (byte) 254
byte VM = (byte) 253
byte …
Run Code Online (Sandbox Code Playgroud)

c# utf-8 character-encoding

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

Maven多个配置文件不起作用

我想把我的战争上传到两个sepearet位置.为此,我在我的pom.xml中定义了以下配置文件;

   ........
    <profile>
    <id>deployPoc</id>
    <activation>
        <activeByDefault>false</activeByDefault>
    </activation>
    <properties>
        <jboss.host>POC_Deploy</jboss.host>
        <jboss.deployDir>/storage2/home/server1/</jboss.deployDir>
        <jboss.deployUrl>scp://server1.com</jboss.deployUrl>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-upload-plugin</artifactId>
                <version>1.1</version>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.maven.wagon</groupId>
                        <artifactId>wagon-ssh</artifactId>
                        <version>2.4</version>
                    </dependency>
                </dependencies>
                <configuration>
                    <resourceSrc>
                        ${project.build.directory}/${project.build.finalName}.${project.packaging}
                    </resourceSrc>
                    <resourceDest>${jboss.deployDir}</resourceDest>
                    <serverId>${jboss.host}</serverId>
                    <url>${jboss.deployUrl}</url>
                </configuration>
            </plugin>
        </plugins>
    </build>
</profile>
<profile>
    <id>uploadUpdate</id>
    <activation>
        <activeByDefault>false</activeByDefault>
    </activation>
    <properties>
        <updateReleaseHost>PluginReleaseSite</updateReleaseHost>
        <updateReleaseDir>/var/www/html/releases/Latest/</updateReleaseDir>
        <updateReleaseUrl>scp://server2.com</updateReleaseUrl>
    </properties>
    <build>
        <plugins>
            <plugin>
            <groupId>com.atlassian.maven.plugins</groupId>
            <artifactId>maven-upload-plugin</artifactId>
            <version>1.1</version>
            <dependencies>
                <dependency>
                    <groupId>org.apache.maven.wagon</groupId>
                    <artifactId>wagon-ssh</artifactId>
                    <version>2.4</version>
                </dependency>
            </dependencies>
            <configuration>
                <resourceSrc>
                    ${project.build.directory}/${project.build.finalName}.${project.packaging}
                </resourceSrc>
                <resourceDest>${updateReleaseDir}</resourceDest>
                <serverId>${updateReleaseHost}</serverId>
                <url>${updateReleaseUrl}</url>
            </configuration>
          </plugin>
    </plugins>
  </build>
</profile>
Run Code Online (Sandbox Code Playgroud)

我试图使用以下命令执行它们并且只执行其中一个命令;

mvn help:active-profiles upload:upload -PdeployPoc -PuploadUpdate
Run Code Online (Sandbox Code Playgroud)

它只执行'uploadUpdate',我已经尝试了所有东西,即-Pa,b; -P …

profile activation maven

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

找出shell脚本中最后一次构建的状态

我有一个Shell脚本的工作,每30分钟后运行一次,下载并接受来自源代码管理的更改.现在我想继续我的shell脚本当且仅当;

  • 我的工作区OR有新的变化
  • 没有新的变化,但我对同一工作的最后一次运行被标记为不稳定.

我查看了Jenkins wiki,但是从明显的环境变量来看,如果不使用Jenkins XML API或某些python脚本在我的构建中编写代码,就不可能找到"我的上次运行"是稳定还是不稳定...是有没有简单的方法来查找这些信息?

jenkins

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