How to create an SArtifactDependency

I am trying to create an artifact dependency to propogage build atrifacts up a dependency tree.

So far as I can see I need to do something like:

List<SArtifactDependency> dependencies = myBuild.getArtifactDependencies();

dependencies.add(new SArtifactDependency());   // I cant see any way to do this.  

myBuild.setArtifactDependencies(artifactDependencies);

where myBuild is of type SBuildType

There was a previous post from 2011 which suggest the use of jetbrains.buildServer.serverSide.ArtifactDependencyFactory but I can't find any such named factory.

I can see how to create an ArtifactDependencyInfo but not how to coerce that into an SArtifactDependency.

Heres my runtime info:

Java version: 1.7.0_72
Java VM info: Java HotSpot(TM) Server VM (32 bit)
Java Home path: D:\TeamCity\jre
Server: Apache Tomcat/7.0.59
JVM arguments:
-Djava.util.logging.config.file=D:\TeamCity\bin\..\conf\logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Xrs -Xmx512m -XX:MaxPermSize=270m -Dlog4j.configuration=file:../conf/teamcity-server-log4j.xml -Dteamcity_logs=../logs/ -Djsse.enableSNIExtension=false -Djava.endorsed.dirs=D:\TeamCity\bin\..\endorsed -Dcatalina.base=D:\TeamCity\bin\.. -Dcatalina.home=D:\TeamCity\bin\.. -Djava.io.tmpdir=D:\TeamCity\bin\..\temp 


and I am running on v9

Thanks

1 comment
Comment actions Permalink

Unfortunately ArtifactDependencyFactory is still a part of closed API. You need to add server.jar to your classpath to get access to it. Here is a javadoc for a couple of methods of this factory for your convenience:

 
/**
* Creates an artifact dependency by a build configuration.
* @param sourceBuildType   the build configuration to depend on.
* @param sourcePaths
* @param revisionRule
* @return
* @since 8.0
*/
SArtifactDependency createArtifactDependency(@NotNull BuildType sourceBuildType,
                                             @NotNull String sourcePaths,
                                             @NotNull RevisionRule revisionRule);

/**
* Creates an artifact dependency by a build configuration specified by its external id.
* @param sourceBuildTypeExternalId   the external id of the build configuration to depend on.
* @param sourcePaths
* @param revisionRule
* @return
* @since 8.0
*/
SArtifactDependency createArtifactDependency(@NotNull String sourceBuildTypeExternalId,
                                             @NotNull String sourcePaths,
                                             @NotNull RevisionRule revisionRule);
0

Please sign in to leave a comment.