How to to define bamboo artifact so its NOT published in syb folder - bamboo

The artifact definition and the file structure in the bitbucket repository is as below.
The build when run creates application-dev.properties & safeguard-dev.properties under classes folder. When i click them it takes me to classes folder inside which the property files are present. But i want them to be published directly like the jar. So that when I click the file it should download. But if i give full path it errors out. Please help me how to define this?
error 19-Dec-2022 16:34:57 Failing as no matching files has been found and empty artifacts are not allowed.
error 19-Dec-2022 16:34:57 Unable to publish artifact [application-dev.properties]:
error 19-Dec-2022 16:34:57 The artifact is required, build will now fail.

Bamboo won't put the artifacts in a subfolder if the "Location" points to exactly where the files are. I.e. don't use the "**" wildcard in the "Copy pattern". I'd say try even to have a separate artifact per properties file.
Your location is pointing to "workdir/src", but you need "target/classes". Get rid of the $bamboo.build.working.directory: that's not the maven build dir and you don't need it altogether (because current work dir is already set to your project dir). If I get the paths right, this should work:
Name: application-dev.properties
Location: target/classes
Copy pattern: application-dev.properties

Related

"no main manifest attribute" error in intellij when executing jar

I'm working on a kotlin project that I want to execute as a jar. This is all done in IntelliJ Idea and I went about making the jar using the artifacts.
The process I followed was (as illustrated by an Idea guide):
Add artifact (as jar) from project structure
Build jar
Run jar
After this, I get a
'no main manifest attribute, in ____.jar'
What I have tried after reading several stack overflow questions:
Checking that the manifest file is in the correct folder and has the correct path in the artifact
Adding code to the build.gradle file for the jar->manifest portion
Trying the method of moving the manifest stuff into a resources folder
Checking that the jar exists
Moving the manifest stuff into a different folder (java,kotlin,out folders)
Making sure that the manifest file is in the correct format
All of the above has not worked.
Something that is confusing to me is that, even when I alter the manifest file to be in "incorrect" format, it still gives the same error. The path stated in the artifact's details is correct yet there is no difference even when I purposely input incorrect items in the manifest file. Not sure if that is the"real" problem but I'm also not sure how to fix that as well
None of the solutions worked for me.
I solved it in this way:
When setting up the artifact, change:
Meta-inf: (...)\src\main\ (you must remove "java")
Also, there was a problem with resources, solved this way:
When setting up the artifact:
Output Layout > Add copy of > Directory content > resources.
That's all!
For anyone that may have encountered this problem in intellij and did not find a solution in any other posts, what helped me was
Navigating to Project Structure
Going to the Artifacts tab
Explicitly adding a new META-INF/ directory in my jar
Adding the created MANIFEST.MF file to the META-INF/ in the jar FROM THE ARTIFACTS TAB
Rearranging the order for the META-INF/ to be at the top
Building and running
The end result looked like this
while creating the exeutable jar file explicitly create a mainfest.txt file
that should be in order of the directory structure and mainfest.txt file should contain only one line (Main-Class:name of the class containg main method)then run the jar tool

TFS 2015 Artifacts always empty upon build

I have created build definition which runs successfully. Now I want to create a release definition on the successful build, for which it is asking for artifacts.
When I tried browsing "Drop" folder, I found it empty.
Below are the images from Copy Files step and Publish build artifacts step.
I also tried instructions from The item MY_ARTIFACT_NAME in container XXX could not be found
But no luck. Please help.
I believe that you should use $(build.sourcesdirectory) (or a path relative to) as the source folder if you want to copy files which are not checked in.
Also, from the documentation of the Copy Files step
The pattern is used to match only file paths, not folder paths. So you should specify patterns such as **\bin\** instead of of **\bin.
Try changing the contents pattern to **\bin\** and see if that helps.

Maven project is not picking local repository after copying

I had a working workspace set up in Maven. Due to unavoidable reasons I have to change my system and hence I need to set up a new workspace. Hence I copied the .m2/repository folder from a working system to the new system.
But unfortunately my local is nopt picking jars from the local repository and it is throwing compiler error. I have copied it to my home directory .m2/repository folder
Can anyone please help me here?
Thanks,
Rengasami R
The local repository path is defined in your settings.xml file (found either in M2_HOME/conf or USER_HOME/.m2). Check that the value of this <localRepository> matches the path you have defined.
Another solution is to run the command mvn help:effective-settings, and it will display the content of the settings.xml Maven is using, so you will find this information easily.

How to have Bamboo artifacts collect a whole folders?

I have one simple plan with one simple job.
Tasks:
Source code checkout
MSBuild
Run tests
Generate test report
In four steps, my utility generates a test report with screenshots. The report contain absolute links to images. (for example: onclick="window.open('./Screenshots/66ef3a03-8b82-4b40-b49d-b0155e273738.png');return false;").
If I open the report on my local machine, the report works fine, but on Bamboo I receive the error "Page Not Found", because Bamboo has not collected "Screenshots" folder.
How can I set up the Artifact Definition to collect folder with files?
P.S. I tried to set the \*.* copy pattern, but Bamboo collected only files (without folders and subfolders)
You just have to give the folder Location, like "build/", for instance, and then, in the Copy Pattern you can put **/*.* That should copy all the files you want.
Please note that:
The location is relative to the build directory. Do not use the absolute path to refer to the location.
Asterisks are not supported for Location. For this field, provide the folder name where the file would be located.
Plus, you can define as many Artifact Definitions as you want.
The best way of doing this is to zip all you artifact together. I created a bash script to do this
cd "toArtifactFolder"
zip -r Artifact .
Then in bamboo project settings you have to edit the Artifact and changed the location to where ever the artifact zip file is
Then in the Copy Pattern just enter the zip file eg Artifact.zip
Bamboo uses the "Ant file copy pattern".
Matching recursively against all files: **/*
This does include almost everything
Unfortunately this does not include dot-files, at least in my test on a linux build agent. I could not find a workaround apart from a second artifact (pattern **/.*) or the creation of an archive.
Matching against all files in any subfolder: */*
This does not include foo/bar/test.xyz
This does include both foo/test.xyz and bar/test.xyz
You can do more advanced matching; e.g. you can use build/**/*.jar to copy all jars from a build directory.
For further info see the docs

Bamboo artifacts

I am very new to Bamboo. I have got a html file generated using log4j. I wish to put it in user-defined artifacts but don't know how.
It is in surefire-reports folder so I tried giving Source directory as "**/target/surefire-reports/" and Artifact Copy Pattern as "**/*.html" but it doesn't seems to work.
Any idea how to configure it?
Try to change copy pattern to
*.html
and verify your complete path.
I wanted to get all surefire reports from each module, so I created a new Artifact definition with:
Name = Surefire Reports
Location =
Copy Pattern = /target/surefire-reports/.*
This was using Bamboo 3.2.2.
The Location field does not provide the Ant file copy pattern feature, only a fixed path is accepted relative to the working directory.
Set the Location as target/surefire-reports
and the Copy pattern as **/*.html
Also make sure that the Shared checkbox is set, otherwise other jobs will not be able to download the artifact.