Camunda BPM 7.2: register engine-plugin in processes.xml - business-process-management

according to docs, you can register a plugin in processes.xml.
(see http://docs.camunda.org/latest/guides/user-guide/#process-engine-process-engine-plugins-configuring-process-engine-plugins).
The XSD says that element 'process-engine' is a complex-type and has an attribute 'name' (see http://camunda.org/schema/1.0/ProcessApplication.xsd).
But when i deploy my process-application with the following processes.xml to camunda-bpm-wildfly-7.2.0, i get this error:
19:16:08,547 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.deployment.unit."firstTestProject-0.0.1-SNAPSHOT.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."firstTestProject-0.0.1-SNAPSHOT.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "firstTestProject-0.0.1-SNAPSHOT.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.1.0.Final.jar:8.1.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]
at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]
Caused by: org.camunda.bpm.engine.ProcessEngineException: cvc-type.3.1.1: Element 'process-engine' is a simple type, so it cannot have attributes, excepting those whose namespace name is identical to 'http://www.w3.org/2001/XMLSchema-instance' and whose [local name] is one of 'type', 'nil', 'schemaLocation' or 'noNamespaceSchemaLocation'. However, the attribute, 'name' was found. | vfs:/content/firstTestProject-0.0.1-SNAPSHOT.war/WEB-INF/classes/META-INF/processes.xml | line 6 | column 34
My processes.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<process-application
xmlns="http://www.camunda.org/schema/1.0/ProcessApplication" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<process-archive name="myBpmApp">
<process-engine name="default">
<plugins>
<plugin>
<class>myrealm.bpm.camunda.engine.plugin.MyIdentityProviderPlugin</class>
</plugin>
</plugins>
</process-engine>
<properties>
<property name="isDeleteUponUndeploy">false</property>
<property name="isScanForProcessDefinitions">true</property>
</properties>
</process-archive>
What do i miss?
Thanks!

The process engine configuration must be outside of the process-archive declaration. Inside the process-archive configuration you can only specify the name of the process engine to use (cf. docs).
For example:
<?xml version="1.0" encoding="UTF-8"?>
<bpm-platform xmlns="http://www.camunda.org/schema/1.0/BpmPlatform"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<process-engine name="my-engine">
<!-- your configuration -->
</process-engine>
<process-archive>
<process-engine>my-engine</process-engine>
<properties>
<property name="isDeleteUponUndeploy">false</property>
<property name="isScanForProcessDefinitions">true</property>
</properties>
</process-archive>
</bpm-platform>

Related

wsImport: jaxb nameXmlTransform not working: A class/interface with the same name is already in use

I need to generate Java classes from a WSDL file.
I'm using the jaxws-maven-plugin plugin configured in this way:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>wsimportPhase</id>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<keep>true</keep>
<verbose>true</verbose>
<packageName>my.package.name</packageName>
<wsdlFiles>
<wsdlFile>${basedir}/wsdl/myWSDL.wsdl</wsdlFile>
</wsdlFiles>
<wsdlLocation>wsdl/myWSDL.wsdl</wsdlLocation>
<bindingDirectory>wsdl</bindingDirectory>
<bindingFiles>
<bindingFile>myBinding.xml</bindingFile>
</bindingFiles>
<sourceDestDir>${basedir}/src/main/java</sourceDestDir>
</configuration>
</execution>
</executions>
</plugin>
And I have configured (with some difficulties) the JAXB bindings in this way:
<?xml version="1.0" encoding="UTF-8"?>
<jaxws:bindings version="2.1"
schemaLocation="myWSDL.wsdl"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
<jaxws:bindings node="wsdl:definitions/wsdl:types/xs:schema/xs:import">
<jaxb:bindings schemaLocation="importedXSD_1.xsd">
<jaxb:bindings node="xs:complexType[#name='DuplicatedType']">
<jaxb:schemaBindings>
<jaxb:nameXmlTransform>
<jaxb:typeName suffix="Suffix1"/>
<jaxb:elementName suffix="Suffix1"/>
</jaxb:nameXmlTransform>
</jaxb:schemaBindings>
</jaxb:bindings>
</jaxb:bindings>
<jaxb:bindings schemaLocation="importedXSD_2.xsd">
<jaxb:bindings node="xs:complexType[#name='DuplicatedType']">
<jaxb:schemaBindings>
<jaxb:nameXmlTransform>
<jaxb:typeName suffix="Suffix2"/>
<jaxb:elementName suffix="Suffix2"/>
</jaxb:nameXmlTransform>
</jaxb:schemaBindings>
</jaxb:bindings>
</jaxb:bindings>
</jaxws:bindings>
</jaxws:bindings>
But when I run mvn install, I have the following error:
[INFO] jaxws:wsimport args: [-keep, -s, '/workspace/myproject/src/main/java', -d, '/workspace/myproject/target/classes', -verbose, -encoding, UTF-8, -Xnocompile, -p, my.package.name, -wsdllocation, wsdl/myWSDL.wsdl, -b, 'file:/workspace/myproject/src/main/resources/wsdl/mybinding.xml', "file:/workspace/myproject/src/main/resources/wsdl/myWSDL.wsdl"]
parsing WSDL...
[ERROR] A class/interface with the same name "my.package.name.DuplicatedType" is already in use. Use a class customization to resolve this conflict.
The XPath finds correctly the needed complexType in the xsd, so I don't understand how to fix it.
I have found the solution combining the solutions explained in these two questions:
wsimport - how to generate service endpoint classes and JAXB classes in separate projects/folders
JAXB schema to Java Different XmlRootElement name and Class name
I have made the following steps:
I have created two binding files, one for jaxws-binding and the other one for jaxb-binding.
These are the two files:
jaxws-binding.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jaxws:bindings version="2.1"
schemaLocation="myWSDL.wsdl"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
<jaxws:bindings node="wsdl:definitions/wsdl:types/xs:schema/xs:import">
</jaxws:bindings>
</jaxws:bindings>
jaxb-binding.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jaxb:bindings version="1.0"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<jaxb:bindings schemaLocation="importedXSD_1.xsd" node="xsd:complexType[#name='DuplicatedType']">
<jaxb:class name="DuplicatedTypeSuffix1"/>
</jaxb:bindings>
<jaxb:bindings schemaLocation="importedXSD_2.xsd" node="xsd:complexType[#name='DuplicatedType']">
<jaxb:class name="DuplicatedTypeSuffix2"/>
</jaxb:bindings>
</jaxb:bindings>
I have declared the two binding files in the <bindingFiles> tag of the jaxb-maven-plugin in the pom.xml
I was doing integration with some company and they gave me their WSDL which I had to import into my project.
Running the below would fail due to naming conflict
wsimport -keep -verbose http://ip:port/path/service?wsdl
I resolved the issue by adding "-XautoNameResolution"
wsimport -keep -verbose -XautoNameResolution http://ip:port/path/service?wsdl
And that was it to resolve my pain point.
Reference (04-08-2021)
https://briskwalk.wordpress.com/2012/03/30/a-classinterface-with-the-same-name-is-already-in-use-error-when-generating-stubs-for-net-service-using-jdk-6-wsimport-command/

Including classpath resource in external log4j configuration

I use external log4j configuration and load it in servlet context listener using org.apache.logging.log4j.core.config.Configurator
I would like to reference some application properties (like application version) that are generated on build time.
Here is what I would like to do:
/external-folder/log4j.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration xmlns:xi="http://www.w3.org/2001/XInclude"
monitorInterval="60">
<xi:include href="log4j2-properties.xml" />
<Appenders>
<Console name="stdout" target="SYSTEM_OUT">
<PatternLayout pattern="%d %5p %t [${app-version}] %m (%F:%L) %n" />
</Console>
</Appenders>
<!-- ... -->
</Configuration>
log4j2-properties.xml
is supposed to be a classpath resource, #version# is filtered by gradle.
<?xml version="1.0" encoding="UTF-8"?>
<Properties>
<Property name="app-version">#version#</Property>
</Properties>
However this approach doesn't work. I can xinclude only resource from the same folder as top level log4j.xml
How can I solve my problem?
(I know how to do this using logback, but I would like to upgrade to log4j2)

Class not found Exception in Apache camel-spring-security Integration

I am trying t integrate apache camel with spring security. I am following the documentation http://camel.apache.org/spring-security.html . I have used spring DSL mode for routing configuration.
Following is my incomplete routing configuration with imported commonDecurity.xml.
camel.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring-security="http://www.springframework.org/schema/security"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/spring-security http://camel.apache.org/schema/spring-security/camel-spring-security.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security.xsd">
<!-- import the spring security configuration -->
<import resource="classpath:org/apache/camel/component/spring/security/commonSecurity.xml"/>
<camelContext id="myCamelContext" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="direct:start"/>
<!-- The exchange should be authenticated with the role of ADMIN before it is send to mock:endpoint -->
</route>
</camelContext>
</beans>
commonSecurity.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring-security="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security.xsd">
<bean id="accessDecisionManager" class="org.springframework.security.access.vote.AffirmativeBased">
<constructor-arg index="0">
<bean class="org.springframework.security.access.vote.RoleVoter"/>
</constructor-arg>
<property name="allowIfAllAbstainDecisions" value="true"/>
</bean>
<spring-security:authentication-manager alias="authenticationManager">
<spring-security:authentication-provider user-service-ref="userDetailsService"/>
</spring-security:authentication-manager>
<spring-security:user-service id="userDetailsService">
<spring-security:user name="jim" password="jimspassword" authorities="ROLE_USER, ROLE_ADMIN"/>
<spring-security:user name="bob" password="bobspassword" authorities="ROLE_USER"/>
</spring-security:user-service>
</beans>
However, when I deploy the bundle in servicemix it throws following ClassNotFoundException.
Exception in thread "SpringOsgiExtenderThread-2"
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
find class [org.springframework.security.vote.AffirmativeBased] for
bean with name 'accessDecisionManager' defined in OSGi
resource[classpath:spring-security/commonSecurity.xml|bnd.id=337|bnd.sym=com.genix.casegenix.esb];
nested exception is java.lang.ClassNotFoundException:
org.springframework.security.vote.AffirmativeBased not found from
bundle [com.genix.casegenix.esb] at
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1278)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:575)
at
org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1347)
at
org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:913)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:617)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)
at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
at
org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
at
org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
at
org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
at java.lang.Thread.run(Thread.java:745) Caused by:
java.lang.ClassNotFoundException:
org.springframework.security.vote.AffirmativeBased not found from
bundle [com.genix.casegenix.esb] at
org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103)
at
org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at
org.springframework.util.ClassUtils.forName(ClassUtils.java:265) at
org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:419)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1299)
at
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1270)
... 11 more Caused by: java.lang.ClassNotFoundException:
org.springframework.security.vote.AffirmativeBased not found by
com.genix.casegenix.esb [337] at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1574)
at
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2018)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at
org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1925) at
org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:978)
at
org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)
... 17 more
I have already installed following features.
spring-security/3.1.4
camel-spring-security/2.16.3
I am using
sevicemix-7.0.0.M2
apache-camel-2.16.3
Any kind help appreciated. Thanks
I get following ClassNotFoundException when I try with https://github.com/apache/camel/tree/master/examples/camel-example-spring-security example.
Exception in thread "SpringOsgiExtenderThread-2"
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0':
Cannot resolve reference to bean 'userDetailsService' while setting
bean property 'userDetailsService'; nested exception is
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
find class
[org.springframework.security.provisioning.InMemoryUserDetailsManager]
for bean with name 'userDetailsService' defined in null; nested
exception is java.lang.ClassNotFoundException:
org.springframework.security.provisioning.InMemoryUserDetailsManager
not found from bundle [com.xxxx.yyyyy.esb]

Dynamically create the version number within the Ambari's metainfo.xml file using maven build processes

I don’t want to hardcode my service version into metainfo.xml, Can I do it?
<service>
<name>DUMMY_APP</name>
<displayName>My Dummy APP</displayName>
<comment>This is a distributed app.</comment>
<version>0.1</version> --------------This I don't want to hardcode, Can I doit?
<components>
...
</components>
</service>
I am using maven as my build tool.
This can be done by using maven's resource filtering. Three steps are required:
Define a maven property that will hold the version number
Add that maven property in between filter tags in the metainfo.xml file
Notate in the pom that the metainfo.xml file needs to be filtered.
For example lets assume you want to use the same version as the projects maven version identifier, ${project.version}, as your version in the metainfo.xml file. You would replace <version>0.1</version> with <version>${project.version}</version>. Then in your pom file you would need to list that metainfo.xml file as needing to be filtered. The procedure for this step will vary depending on how you are bundling the custom Ambari service (rpm, assembly, etc.). In general whichever plugin you are using when you list the sources (content to include in the bundle) you will need to specify the path to the metainfo.xml file and make sure filtering is set to true.
Now lets assume you want to create an rpm that will install your artifact. It would look something like this:
Your project structure should be as follows:
--src
--main
--resources
--configuration
--scripts
metainfo.xml
Your pom file would look like this:
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<version>0.0.1-SNAPSHOT</version>
<artifactId>com.example.project</artifactId>
<packaging>pom</packaging>
<properties>
<hdp.name>HDP</hdp.name>
<hdp.version>2.3</hdp.version>
<stack.dir.prefix>/var/lib/ambari-server/resources/stacks</stack.dir.prefix>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>rpm-maven-plugin</artifactId>
<version>2.1.2</version>
<extensions>true</extensions>
<executions>
<execution>
<id>generate-hdp-rpm</id>
<phase>package</phase>
<goals>
<goal>attached-rpm</goal>
</goals>
<configuration>
<classifier>hdp</classifier>
<needarch>true</needarch>
<sourceEncoding>UTF-8</sourceEncoding>
<distribution>blah</distribution>
<group>something/Services</group>
<packager>company</packager>
<vendor>company</vendor>
<name>SERVICENAME-ambari-hdp</name>
<defineStatements>
<!-- I use the below line to prevent compiled python scripts from failing the build -->
<defineStatement>_unpackaged_files_terminate_build 0</defineStatement>
<defineStatement>platform_stack_directory ${stack.dir.prefix}/${hdp.name}/${hdp.version}</defineStatement>
</defineStatements>
<requires>
<require>ambari-server</require>
</requires>
<mappings>
<mapping>
<directory>${stack.dir.prefix}/${hdp.name}/${hdp.version}/services/SERVICENAME</directory>
<filemode>755</filemode>
<username>root</username>
<groupname>root</groupname>
</mapping>
<mapping>
<directory>${stack.dir.prefix}/${hdp.name}/${hdp.version}/services/SERVICENAME</directory>
<directoryIncluded>false</directoryIncluded>
<filemode>755</filemode>
<username>root</username>
<groupname>root</groupname>
<sources>
<source>
<location>src/main/resources/metainfo.xml</location>
<filter>true</filter>
</source>
</sources>
</mapping>
<mapping>
<directory>${stack.dir.prefix}/${hdp.name}/${hdp.version}/services/SERVICENAME/configuration</directory>
<filemode>755</filemode>
<username>root</username>
<groupname>root</groupname>
</mapping>
<mapping>
<directory>${stack.dir.prefix}/${hdp.name}/${hdp.version}/services/SERVICENAME/configuration</directory>
<directoryIncluded>false</directoryIncluded>
<filemode>755</filemode>
<username>root</username>
<groupname>root</groupname>
<sources>
<source>
<location>src/main/resources/configuration</location>
</source>
</sources>
</mapping>
<mapping>
<directory>${stack.dir.prefix}/${hdp.name}/${hdp.version}/services/SERVICENAME/package</directory>
<filemode>755</filemode>
<username>root</username>
<groupname>root</groupname>
</mapping>
<mapping>
<directory>${stack.dir.prefix}/${hdp.name}/${hdp.version}/services/SERVICENAME/package/scripts</directory>
<filemode>755</filemode>
<username>root</username>
<groupname>root</groupname>
</mapping>
<mapping>
<directory>${stack.dir.prefix}/${hdp.name}/${hdp.version}/services/SERVICENAME/package/scripts</directory>
<directoryIncluded>false</directoryIncluded>
<filemode>755</filemode>
<username>root</username>
<groupname>root</groupname>
<sources>
<source>
<location>src/main/resources/scripts</location>
</source>
</sources>
</mapping>
</mappings>
</configuration>
</execution>
<!-- You may have multiple executions if you want to create rpms for stacks other then HDP -->
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- List any dependencies you need -->
</dependencies>
This will create an rpm that when installed will add your service to the HDP 2.3 stack. After installing the rpm you would have to restart ambari-server to make sure the new service definition is picked up.
Update:
To create additional RPMs for other stacks, you will need to:
Duplicate the execution block in the rpm-maven-plugin section of the pom.
Change the id element of the new execution to be unique.
Modify the mappings to reflect the directory/file structure you want for the other stack.

Ivy Resolve of "latest.integration" fails when run from Jenkins

so I have an existing ant build and I'd like to resolve its dependencies using Ivy. I have an ivy.xml and ivysettings.xml file which both work with IvyDE in Eclipse and also work when run from the command line against the ivy-2.3.0.jar. (They work as in Ivy reports it has downloaded the dependencies).
The problem I have is that they do not work when running from the any build script when the 'rev' attribute is listed as 'latest.integration'. If I specify a version then the dependency is resolved. To be clear this specific dependency is an internal library that is hosted by Artifactory.
I'm fairly stumped as to what I can change or try to identify the problem. I get the same failure when running an ivy findrevision.
To note Jenkins is running on a mac, but I can use the Ivy jar directly to resolve the dependencies using the same ivy files on that machine, the problem is only related to when resolving through Jenkins.
I realise this isn't likely to be something someone can look at and point directly to the problem, especially given that in seemingly all other situations, even running the snippet from the ant build through eclipse, the resolve works correctly. But if anyone has any suggestions they'd be more than welcome!
Anyway my ivy.xml
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info
organisation="MyOrg"
module="MyModule"
status="integration">
</info>
<dependencies>
<dependency org="MyOrg" name="DEP" rev="latest.integration">
<artifact name="DEP" type="jar" ext="jar" />
</dependency>
<dependency org="junit" name="junit" rev="4.8.1" />
</dependencies>
</ivy-module>
And my ivysettings.xml (The dependency is named for example DEP-0.1-SNAPSHOT.jar)
<?xml version="1.0" encoding="UTF-8"?>
<ivy-settings>
<settings defaultResolver="snapshot" />
<!--Authentication required for publishing (deployment). 'Artifactory Realm' is the realm used by Artifactory so don't change it.-->
<credentials host="HOST" realm="Artifactory Realm" username="USR" passwd="PASS" />
<resolvers>
<chain name="main">
<!-- <ibiblio name="release" m2compatible="true" root="http://HOST/artifactory/libs-release" /> -->
<chain name="snapshot" changingPattern="0.*" checkmodified="true">
<ibiblio name="public" m2compatible="true" root="http://HOST/artifactory/libs-snapshot" />
</chain>
</chain>
</resolvers>
</ivy-settings>
And finally my build script looks something like
<project name="MyModule Continuous Integration" xmlns:ivy="antlib:org.apache.ivy.ant">
....
<target name = "resolveDependencies" >
<ivy:configure file="/MyModule/ivysettings.xml" />
<ivy:findrevision organisation="MyOrg" module="DEP" revision="latest.integration" property="found.revision" />
<echo message="Found revision: ${found.revision}" />
<ivy:resolve file="/MyModule/ivy.xml" refresh="true" type="jar" />
<ivy:cachepath pathid="ivy.dependencies" />
</target>
....
</project>
And for completion the sort of output I'm getting from the Jenkins build is:
[ivy:findrevision] snapshot: Checking cache for: dependency: MyOrg#DEP;latest.integration {}
[ivy:findrevision] don't use cache for MyOrg#DEP;latest.integration: checkModified=true
[ivy:findrevision] default-cache: no cached resolved revision for MyOrg#DEP;latest.integration
[ivy:findrevision] tried http://HOST/artifactory/libs-snapshot/MyOrg/DEP/[revision]/DEP-[revision].pom
[ivy:findrevision] CLIENT ERROR: Not Found url=http://HOST/artifactory/libs-snapshot/MyOrg/DEP/maven-metadata.xml
[ivy:findrevision] maven-metadata not available: http://HOST/artifactory/libs-snapshot/MyOrg/DEP/maven-metadata.xml
[ivy:findrevision] WARN: problem while listing resources in http://HOST/artifactory/libs-snapshot/MyOrg/DEP/ with public:
[ivy:findrevision] WARN: java.lang.NullPointerException null
[ivy:findrevision] tried http://HOST/artifactory/libs-snapshot/MyOrg/DEP/[revision]/DEP-[revision].jar
[ivy:findrevision] maven-metadata not available: http://HOST/artifactory/libs-snapshot/MyOrg/DEP/maven-metadata.xml
[ivy:findrevision] WARN: problem while listing resources in http://HOST/artifactory/libs-snapshot/MyOrg/DEP/ with public:
[ivy:findrevision] WARN: java.lang.NullPointerException null
[ivy:findrevision] public: no ivy file nor artifact found for MyOrg#DEP;latest.integration
Property "found.revision" has not been set
[echo] Found revision: ${found.revision}
Thanks again for any ideas,
Dan.
For future reference, I have managed to resolve this by swapping to the latest Ivy 2.4 alpha build. Seems it must have been a problem with 2.3.0.

Resources