I've been googling how to connect to a TeamCity server and download a specific .war file. No luck.
I'm writing an application that needs to connect to TeamCity, download a war file, upload it to a server and some other stuff.
I can't figure out the TeamCity thing. Any suggestions?
You can do this with artifacts in TeamCity. For example you add the following artifact path to your configuration: src\YourProject\bin\Release\* => YourBuild.zip
This will pack all files located in this folder in the zip file. See this blog post for more examples.
The zip file itself is then available for download e.g. http://localhost:8080/repository/download/bt6/180:id/YourBuild.zip
To get the proper IDs (here bt6 and 180) for your download link you can use TeamCity's REST API.
Here is the official documentation how to download build artifacts from TeamCity server.
Commons HTTP client is known to work well. You need to authorize or to enable public access to your artifacts (see more on this).
Hope this helps,
KIR
Related
I have downloaded the jbpm-server-7.30.0.Final-dist zip file from the JBoss website, extracted the contents, and then run the standalone.bat file. The Wildfly server starts and I can see the deployments for the Business Central and Kie Server web applications. The Business Central website works correctly at this url http://127.0.0.1:8080/business-central. I can create a simple project, build and deploy it, all local with no extra repositories.
Within Business Central I can navigate to the Artifacts page and download the JAR for my simple project. I can install the downloaded jar into the local maven and work with it in my Java application.
The question is - Can I access the repository as a normal maven repo in a java projects via the POM.XML file? If this can be done what is the url to access it?
I tries various urls ..
http://127.0.0.1:8080/business-central/maven/project_name
http://127.0.0.1:8080/business-central/.m2maven/project_name
http://127.0.0.1:8080/kie-wb/maven/project_name
But none of them worked.
The documentation suggests
[protocol]://[hostname]:[port]/[context-root]/maven2/[groupId replacing '.' with '/']/[artifactId]/[version]/[artifactId]-[version].jar
And provides an example:
http://localhost:8080/business-central/maven2/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar
Perhaps it's the 'project_name' bit that you need to change?
In some situations (like not having money on balance), my internet provider redirects any HTTP request to a simple html stub.
Recently maven cache on my dev machive was flooded by jar files with content consisting of an html stub from my internet provider. These jar files were not noticed during the build and ended up being deployed to Tomcat as a part of my project artifacts. I noticed problem thanks to warnings about corrupted jar files at Tomcat log. Obviously, I want to avoid this situation in future.
I see that at a maven cache, there are *.sha1 files that are expected to contain integrity checksums for jar files. In my case, these *.sha1 had also wrong content (consisting of an html stub).
How can I configure maven to fail during artifact download or during build process if jar file content does not match the integrity checksum?
The Maven version I use is 3.3.9.
Pass the command-line option --strict-checksums.
https://books.sonatype.com/mvnref-book/reference/running-sect-options.html#running-sect-deps-option
-C, --strict-checksums
Fail the build if checksums don’t match
In Maven 4.0.0-alpha-2, if a downloaded file fails the checksum check, the build will fail. This used to be a warning.
Jira-Issue: https://issues.apache.org/jira/browse/MNG-5728
If you work with an IDE like IntelliJ, there is an option as well:
I'd like to automatize the following:
when I build my Java SE project on Netbeans, the jar and its dependencies should be uploaded to a server and started.
How do I do that? If scripting or config some xml is involved, Where could I find some tutorial on the syntax to be used?
You should use the Maven Invoker Plugin for this and set a postBuildHookScript, as described here. From the script, handle the JAR upload.
This answer discusses uploading files to remote servers using bash.
How can i use "ua-parser" in my web application?. I can't find any jar archive in git hub repository https://github.com/tobie/ua-parser. I searched google but I can't find any websites for ua-parser.
Where can i download ua-parser for jar archive?.
Is there any website for ua-parser?
Is anybody using ua-parser?. Please help me.
Clone the repository and run mvn package from the java folder.
This is explained in details here
You'll end up with a jar (actually a bunch of jar if you count the dependencies)
My Maven builds a ready zipped package that just has to be uploaded to a ftp server.
Is there a plugin for this task? It should start when I choose the deploy goal.
I see some ftp support for the real way Maven deploys files, but nothing for a custom ftp upload.
What do you mean by a "custom" upload?
The deploy plugin doco describes how to normally deploy a build artifact using ftp.