This is my current working setup:
I want to automate these variables:
Is there a way to automate the version number in this build step? E.g. extract it from the root pom.xml?
I already tried putting ${project.version} inside the version field, but that didn't work either. Which placeholder am I required to use here, as the field is a required value and cannot be left empty?
Write ${POM_VERSION} instead of 1.0.0
You can also use ${POM_GROUPID} and ${POM_ARTIFACTID} for the group and for the id of the project.
Related
Question:
Is it possible to add different plugins with different purposes which resolve to the same name?
Example:
plugins {
…
id("org.owasp.dependencycheck") version "5.2.4"
id("dependency.check") version "0.0.6"
}
which results to following exception:
An exception occurred applying plugin request [id: 'dependency.check', version: '0.0.6']
> Failed to apply plugin [id 'dependency.check']
> Cannot add extension with name 'dependencyCheck', as there is an extension already registered with that name.
Is there any known or possible work around I could apply to resolve this name conflict?
Not easily, no. You would have to conditionally apply one and not the other, e.g. based on a property or command line parameter, if you really want to go down that route.
But are you aware that the second plugin (dependency.check) is an old fork of the first (org.owasp.dependencycheck)? It doesn't even look like it has any changes compared to the main repository, except that it hasn't been updated in four years.
It doesn't really make any to have two variants of the same plugin in the same project. You should delete the old one.
I would like to search for a project's line coverage using the SonarQube Web API.
The entrypoint to my search is the github repository uri.
So something like this: git#github.com:user/my-project.git.
Currently, I am cutting out the repo name and try to find the project using /api/projects/index?search=my-project - assuming that the github repo name should be contained in the sonarqube project name.
I pick up the project key from the response and use it with /api/measures/component to retrieve the overall_line_coverage.
We are using the SonarQube gradle plugin to create the SonarQube project. We also set the sonar.branch property. So we end up with project keys like <groupId>:<artifactId>:<sonar.branch>.
Is there a better/more robust way to do this search - especially I would like to add the sonar.branch to the query the narrow down the search result.
go to your project homepage to get the project key OR use the internal (made public in 6.3) WS api/components/search with the q parameter
use the WS api/measures/component to retrieve your project measure
We have created maven archetype for users to generate project. Now we want a certain archetype property to be set using the user input. Can somebody point out a way by which we can prompt the user for input during project generation and use the input to set the property?
Make use of a property file, visit http://maven.apache.org/archetype/maven-archetype-plugin/examples/create-with-property-file.html to see how this works.
The Docs show this
/repository/downloadAll/BUILD_TYPE_ID/BUILD_SPECIFICATION
for getting all of your artifacts as a zip file, but that isn't using the REST API. Is there a way in the REST API do do the same thing? The Docs seem to indicate that the repository links are only there for backwards compatibility.
You can use this URL, it works for me:
http://<TeamcityUrl>/httpAuth/app/rest/builds/id:<BuildId>/artifacts/archived
I use TeamCity 9.
From the documentation: http://confluence.jetbrains.net/display/TW/REST+API+Plugin#RESTAPIPlugin-buildartifacts
Artifacts:
GET <TeamcityUrl>/httpAuth/app/rest/builds/<buildLocator>/artifacts/files/<artifact relative name>
If you download the artifacts from within a TeamCity build, consider using teamcity.auth.userId/teamcity.auth.password system properties as credentials for the download artifacts request: this way TeamCity will have a way to record that one build used artifacts of another and will display that on build's Dependencies tab.
have you tried this?
I'm not sure it's documented, but it works.
http://teamcity-url/downloadArtifacts.html?buildId=216886
If you are using it from .NET you may use the following code:
List<string> downloadedFiles = new RemoteTc()
.Connect(a => a.ToHost("tc").AsGuest())
.DownloadArtifacts(123, #"C:\DownloadedArtifacts");
The above code uses FluentTc library
I'm generating maven site content using the site plugin. I want to have a little table that shows my maven group id, artifact id, parent info, etc on the module. I don't see a plugin for it, so I was going to use the APT format and create a content page with a table for it. The documentation says I can use property replacement in the site descriptor via ${project.name} etc. This fails when i use it in both the descriptor and in my index.apt file. Has anybody seen this done or know how to do it?
The mvn site command generates a Project Summary page which has this information on it. Does that work for you?
For example, when I execute mvn site, get an output here target/site/project-summary.html where the page has a section like so:
Build Information
Field Value
GroupId com.a.b
ArtifactId myapp
Version 1.01.13-SNAPSHOT
Type jar
If you want to create pages which use placeholder like ${project.version} etc. you need to use index.apt.vm (velocity files) wher the replacement works. But for the information you have asked the solution which has been described (project-summary.html) is the right way cause it's automatically generated.