I am trying to host a jave project. I have build the pipeline by setting up the parameters as shown in the images but the i am encountering the error saying ##[warning]Directory '/home/azureuser/myagent/.\run.cmd/5/a' is empty. Nothing will be added to build artifact 'drop'. How do I fix this?
It seems you want to publish your jar package to build artifact 'drop'. Jar package should be in the $(System.DefaultWorkingDirectory)\target folder. Thus, you need to use the copy file task to copy jar package from target folder, then publish the package to drop.
You could also check the log of Maven task to see the specific location of jar package.
Related
I'm trying to migrate the artifacts of a maven project from Sonatype Nexus to Azure Artifacts and I'm following the steps described here.
So it's basically
mvn clean install: Creates a local copy of the artifacts.
Change the repository and distribution management URL and point to the destination Azure feed url.
mvn deploy: Deploys the artifacts into Azure feed.
This must work. But the project that I'm working on has a parent, which is provided to us externally and is not in maven central. That parent is not getting deployed and is missing from Azure Artifact feed and is resulting in an error.
Sample pom.xml
<project xmlns....>
<parent>
<groupId>parent.pom..
..
</parent>
<groupId>main.project...
<name>project..
<version>x.x..
<packaging>pom..
....
....
</project>
Getting error on trying to build the project from Azure Artifact.
C:/...MainProject> mvn clean install
...
...
[ERROR][ERROR] Some problems were encountered while processing the POMs
[FATAL] Non-resolvable parent POM for main.project...: Could not transfer the artifact parent.pom
Tried to create a small project with only parent pom as dependency and tried to upload it Azure Artifact feed.
But a similar error is being thrown up.
According to your description, please check if there is a proxy in your internet.
And try to delete the .m2 local Directory and run mvn clean install again to check if it works.
You can refer to this answer.
Im a newbie to azure and maven. I have created a build pipeline and it is dropping artifacts to Build.ArtifactDirectory. In CD pipeline, there is a java class which uses System.getProperty("user.dir"). But this path is taking wrongly and it throws ClassNotFoundException.
Reason for this:
Actual artifacts in cd after drop is present in path: C:/agent1/1/a/buildpipeline/drop/s/TestCode/src/main/read.java
user.dir : is searching in path: C:/agent1/1/a/ in which the code is not available.
Fix the issue:
To fix this, i need to manually pass the user.dir value through maven commandline that is -Duser.dir="pathname". But this is not working
I can change the artifact drop path from build pipeline and include a task of download artifact in release pipeline - Is not working because, I need to add a maven task to integrate pom.xml and it is automatically showing the path C:/agent1/1/a/buildpipeline/drop/s/TestCode/pom.xml.
Please help me with a solution
I have a multi-module maven project in azure repo:
Parent
----App
--POM.xml
----Core
--POM.xml
----API
--POM.xml
----ParentPOM.xml
When I tried to build App project in Azure, I am getting the following error: [ERROR] Failed to execute goal on the project: Could not resolve dependencies for project com.core:jar:1.0: Could not find artifact com.core:jar:1.0 in central (https://repo.maven.apache.org/maven2).
So I tried to create multiple tasks in the same azure build to package for each module (App, Core, API), which also gives the same result. Could someone please help me on how to build the multi-module project and get the App jar file.
The way I've done it:
with this command: install -pl (module name) -am
where the module name should be one of the submodules. If you want to build all of them then only go with install
I have found the solution for the multi-module maven dependency issue, First We need to build the parent pom.xml, then build the submodules as per hierarchical order. In between each module, add a task to copy and move the jar files to the staging directory. Here shared the image of my build steps. Please take a look and comment on any questions.
Please look into the DevOps configuration for reference
I created a build definition using yarn custom extensions.
The build works fine:
But, apparently the yarn build task does not generate any output
What am I missing here to be able to generate a build output that I can deploy to azure?
Update 1:
I was able to configure the copy, but its copying the entire folder even with node_modules to the drop. There should be a build folder only
The task "Publish Artifact" publishes the build artifacts that exist on the agent in folder "a".
If you don't copy the output to folder "a", the publish task will not publish anything and you will get the message:
Directory '...\a' is empty. Nothing will be added to build...
Before the Publish Artifact task, you need to add the Copy Files task, in this task you should copy the Yarn output to the folder "a" in the agent, after it the publish will success.
I have a teamcity (4.something) install that creates .wsp file for deployment to sharepoint. Currently I have to copy the wsp out of the build artifacts directory and into a little deploy folder I have created. In the folder I run a .bat that deploys the new .wsp to our test server.
What steps can I take to automate this?
Either copy the .bat into the artifacts folder and update the paths etc or copy from the artifacts folder into the 'deploy' folder and run the .bat from there.
I am a neophyte when it comes to the intricacies (or basics!) of MSBuild and the like... so hand holding is appreciated!
In more recent versions of TeamCity...
In the build definition you can identify artifacts which can be copied/zipped. Artifacts can then be downloaded manually or referenced from another build (Artifact Dependency).
You can setup a 'build configuration' to do your deployment directly from artifacts produced by your ci build.
Create a build to do your deployment
Build Step
Run: Executable with parameters
Command executable: .bat file (make sure it as part of the ci build artifacts generated)
Command parameters: whatever parameters your patch files needs
Dependencies
Add New Artifact dependency
Depend on: select the ci build you want to deploy
GetArtifacts from: Last successful build
Artifact rules: +:**/*.*
So, given artifacts (like your batch file) are in the CI build... You now have a 'deploy' build. When you run it (manually or setup a Build Trigger) it will copy all the CI build artifacts to it's working directory (Artifact Dependency) and then run your batch file to do the deployment.
Pretty slick.
note: just make sure that the account running the TeamCity BuildAgent has permissions to do all the deployment stuff.
Hope this helps somebody as it took me a while to sort this out ;)
I've done this by creating a nant task, and then having TeamCity execute the nant task. It's more of a pain than it should be. You should be able to do the same as a post-build event with MSBuild.