Archive multiple artifacts in multiple folders in jenkins? - maven

I am trying to archive both the target/surefire-reports from my Maven project (easy), but in addition archive files that my project creates that are in the base workspace (csv report). Do I do something like this: target/surefire-reports/**/*, *.csv?

looks like you are doing the right thing.
my syntax is logs//.exec,logs//.log,obsQueue.txt, and it works.
make sure you that those files really exist in the workspace.
note that all archive files , are relative to the workspace.
let me know if I can help with this issue.

Related

Is there a way to make Gitlab CI recognize a POM.xml file in a folder?

I am writing an automated testing project for school using maven and I need to implement CI to our project. Since Gitlab has its own CI, I decided to use it.
The problem is that the project itself is inside of a folder in a Gitlab repository. I created a branch for that project, but the branch main body includes the project folder, so when I create a gitlab-ci.yml file, it cannot find the POM.xml file in the folder. So my question is that is there a way to make the yml file recognize the POM file by adding some sort of variable to it?
I know there are "only:" and "changes:" keywords for the yml file but that doesn't seem like it will help recognize the pom file. Also manually pushing a yml file that is inside of the project folder does not help. I haven't tried moving the POM file because the project grade is also dependent on the quality of our commits, so I would rather not commit wildly.
Using
- mvn -f project/pom.xml compile
instead of -mvn compile in the build: section of the .yml file solved it for me. I was blind and didn't see that there was a help section in the log that already answered my question.

Maven: how to copy a directory cleanly before creating the JAR?

I want to store some additional files in the JAR that gets created. Those files are in a directory that is a subdirectory of a repository which is pulled in via a git submodule.
I want to copy that submodule to my src resources directory before compiling, but I also want to make sure that any old files at that location are removed first.
How can that be achieved best with Maven plugins? I did not find any option to remove any destination files with the copy-resources goal of the maven-resources-plugin and I could not get the maven-clean-plugin to run right before the copy-resources either. So how does one accomplish such a trivial task with Maven?
UPDATE: as mentioned above, the reason why I want to do this is because what is copied should become part of what gets added to the resulting jar (and could potentially be part of what gets compiled). So I need to copy these files into the src directory and NOT the target directory. What should get copied before each build is the input to the build, not an additional output.
There is one flaw in your approach, and it probably explains most of the obstructions you encountered.
During a build, the only directory in which you may write is target. Copying files to src or changing them is strictly discouraged.
The target folder is erased by clean, so no need to tidy up yourself or to manage old files.

How can I generate multiple Jenkins artifacts and zip them together?

I'm using Jenkins to generate a war file, which so far, works, but I need to grab this war file and zip it together with some script files located in the project's workspace.
I'm really new with Jenkins and don't know how to proceed, any help would be appreciated.
Thank you

Advice needed with Teamcity artifact paths

For a .NET Developer, the Teamcity artifact paths are not very straightforward.
Per project I do, I have a folder called BuildTools and, within it, folders called Drops and Inputs (drops being the reports and outputs inputs being the config files for various command line apps).
BuildTools/Drops/NDependOut => GenericSolution/Drops/NDepend
Is this correct? BuildTools is from the root of the (custom) checkout dir, and then GenericSolution is from the root of the artifacts path (Called "Artifacts" folder).
The other problem I have is that the NDepend report has a lot of images etc in the same folder as the .html file. How would I upload this? Do I upload the entire folder (in which case, is the syntax above correct?)
In general this is right. TeamCity has an option to zip artifacts before publish. For that use the following syntax
Folder/folder/*/ => destfolder/archive.zip
Another trick is to use TeamCity service message to publish artifacts dynamically from build script.

How to configure Hudson to archive empty folders

I have the following sample / test configuration that has Hudson create a directory of empty folders. Its then instructed to archive everything within that folder, except it will not match empty folders and ends up archiving nothing. Whats more annoying is that Hudson does not alert you that nothing matches the search string "root**", but when it builds, it says nothing matches the search string.
(source: 86th.org)
We need Hudson to archive these empty folders for our installer since its expecting them. I fear this may not be possible because of the text "Files to archive".
At any rate, How can I configure Hudson to archive empty folders as an artifact.
You should create the artifact that you want in your build scripts, and then have hudson archive that file. So if you want a zip file that contains empty folders, do the appripriate zip command in your batch file or ant script. Then archive the output file.
Looking at the Hudson source code, it seems as if artifact archiving is meant to only match against files.
You might want to file a feature request or send an email to the USERS list, the Hudson team is pretty good about replying to requests and/or adding features in new releases.
I see three ways:
have your application NOT expect the folders but create them on demand.
or have the application create the folders at startup.
or you could just add dummy files in the folders :) just thinking out of the box.

Resources