I'm using Maven to generate an archetype. I'm able to get the archetype to generate fine and the project template it generates works as expected. The only problem is in my shell scripts. Anything commented out in the script gets stripped leaving behind only commands. I've searched high and low and all I've been able to find was another user facing a similar issue with java comments. https://stackoverflow.com/questions/18797333/maven-archetype-generation-is-stripping-java-comments That question remains unanswered, so I figure I'll ask again. Does anyone know why Maven archetypes strip comments or how to prevent this from happening?
Using the #set command itself to set a #hash variable equal to "#" worked, allowing me to maintain shell comments in scripts generated by the archetype. This can get relatively ugly when using 80 # symbols in a row in a header, but that's another matter...
I also had a similar problem with hashes. On page http://johnjianfang.blogspot.com/2009/03/escape-properties-in-maven-archetypes.html I found answer.
Something like this works fine in my case:
#set($hash = '#')
${hash}
Output:
#
Maven uses Apache Velocity to perform substitutions/replacements when copying your archetype's template files to the project locations. The '#' character is used to begin directives, e.g. #set, in Velocity. My guess is that Velocity doesn't recognize your comment as a valid directive and silently deletes it during the replacement process.
Though I haven't verified this works - I would try escaping the comments with using a backslash (\) as defined in Velocity's user manual to solve the issue.
Related
I'm integrating the WireGuardKit, according to its README file, I need to create an external build system target to build wireguard-go-bridge library.
In the external build system target's info tab. The documentation says I should use this location: ${BUILD_DIR%Build/*}SourcePackages/checkouts/wireguard-apple/Sources/WireGuardKitGo
The build for the external build system target failed. As the path can't be resolved.
If I change the path with a correct, absolute path, the build will succeed.
Can anyone tell me what's the meaning of this ${BUILD_DIR%Build/*}, looks firebase is also using this magic variable, see Firebase Crashlytics | Swift Package Manager (SPM) Run Script?
After some googling, I figured it out:
Quote SuperUser contributor Marek Rost's Post:
When the percent sign (%) is used in the pattern ${variable%substring}, it will return content of the variable with the shortest occurrence of substring deleted from the back of the variable.
This function supports wildcard patterns, that is why it accepts an asterisk (star) as a substitute for zero or more characters. It should be mentioned that this is Bash specific. Other Linux shells do not necessarily contain this function.
If you want to learn more about string manipulation in Bash, then I highly suggest reading the following page, Advanced Bash-Scripting Guide: Chapter 10. Manipulating Variables. Among many other handy functions, it explains what a double percent sign (%%) does, for example.
I forgot to mention that when it is used in the pattern $((variable%number)) or $((variable1%$variable2)), the percent sign (%) character will function as a modulo operator.
When the percent sign (%) is used in different contexts, it should be recognized as a regular character only.
So suppose ${BUILD_DIR} is
~/Library/Developer/Xcode/DerivedData/wgShowcase-dejirdnsktlwtagdrhljeefdnxvi/Build/Products
What ${BUILD_DIR%Build/*} mean is delete the shortest occurrence of substring Build/*(the star sign is a wildcard) from the back of ${BUILD_DIR} variable. In this case, the Build/Products will be removed. then we have the result:
~/Library/Developer/Xcode/DerivedData/wgShowcase-dejirdnsktlwtagdrhljeefdnxvi/
So since all the SPM packages used by this project checks out at a child directory at ~/Library/Developer/Xcode/DerivedData/wgShowcase-dejirdnsktlwtagdrhljeefdnxvi/, the final resolved path should be:
~/Library/Developer/Xcode/DerivedData/wgShowcase-dejirdnsktlwtagdrhljeefdnxvi/SourcePackages/checkouts/wireguard-apple/Sources/WireGuardKitGo
As for why the build is not succeed, I think it's a Xcode bug. I have reported a bug to apple. For anyone who is trying to build.
Use below as a workaround:
${BUILD_DIR}/../../SourcePackages/checkouts/wireguard-apple/Sources/WireGuardKitGo
Update: Here is the response from Apple regarding to this 'issue'
After reviewing your feedback, we have some additional information for you, or some additional information, or action is necessary for this issue:
The Directory field here is not evaluated as a bash variable, it’s evaluated as an Xcode build setting, which does not support bash operators such as %.
You would likely need to set the working directory to a known directory with a makefile, and then have that makefile use makefiles from the ultimate target directory.
We noticed that when we clone the repo it comes with macOS and iOS targets whose directories are set to $(PROJECT_DIR)/Sources/WireGuardKitGo, so we're wondering if the project owner has updated the project to fix this issue, but hasn’t updated the documentation.
In any event, this is behaving correctly.
I want to run soapui with Maven, but has problem here and can't find any solution on the internet, want to know: How to overrides testCaseProperties just like projectProperties or testSuiteProperties in pom.xml file?
Reference: https://github.com/redfish4ktc/maven-soapui-extension-plugin/wiki/Tips
Screenshots as here:
Screenshots
The Maven plugin you link to clearly doesn't support that. Then I believe you are limited to the options given by the command line interface.
https://www.soapui.org/test-automation/running-from-command-line/functional-tests.html
From that, my guess would be that you can't. Not by only using this.
However, you may consider creating some sort of setup script for your TestSuite, that reads a project property, which can be set from the commandline. That one property may then be path and name for some sort of input file, and the script can then read it, and import any setting you have specified within to set any variables you may wish.
I've been trying to make my .mailmap file to work globally in Windows, without having to put it at the root of each repository.
So I've moved it to C:\Users\.mailmap and added in the config file the following:
[mailmap]
file = 'C:/Users/<username>/.mailmap'
But it doesn't work.
I've tried all variations of no-quotes, single quotes, double quotes, single slash, double backslash... and I haven't been able to make it work. I've also tried using a more Windows-friendly file name, like MailMapGlobal.txt (similar to the GitignoreGlobal.txt I have that works just fine).
While researching the problem I've found this apparently unresolved question from 2011, which is pretty much the same, and I was wondering if there's been any news on this issue in the last 6 years or if there's a known solution that is not listed in that question.
I'm using Windows 7, with git 2.13.2.windows.1
I have all my scenarios properly tagged and working.
I am trying to set it up so that depending on the goal that is set, only specific tags or feature files (whatever is possible) run.
I've looked at other related questions but didn't find one that seem to work for me.
I don't need to put anything conditional in as I've seen in a previous question that's not easily doable.
I did see in another question they found a way of doing it my making a Cucumber.Run super class and passing in the needed options then but there weren't further details.
And recommendations would be great.
I tried using various profiles/builds to exclude all but the desired feature file but Cucumber.Run seems to ignore that after my research.
To make it clear, basically I have:
File1.feature
#scenarioForFile1
----------------
File2.feature
#scenarioForFile2
----------------
File3.feature
#scenarioForFile3
And I need to control which set of tests is kicked of either by scenario or file name.
After another day of research I was able to find the answer and feel stupid because I've looked at the usage docs several times but thought I couldn't do what the example showed in my use case.
Now I just have various build set up that run the project using different tags in the command line argument. I thought it was necessary to use the pom but it was not.
Used the below two links:
https://github.com/cucumber/cucumber/wiki/Tags
Maven running cucumber specific feature files or folders
I have a project and I've found that the content in search path has many backslash at the beginning and the end of the correct search path.
It it like
\\\\\\\\\\\\\\"$(SRCROOT)/MY-SEARCH-PATH"\\\\\\\\\\\\\\\
So is it a bug or something I did wrong?
It looks like you're using some kind of tool (like Cocoa Pods or similar) on your project that modifies the project file. This tool might have a buggy way of interpreting build settings and saving them again.
No idea, however it's wrong and should be changed back to:
$(SRCROOT)/MY-SEARCH-PATH
(i.e. no backslashes and no double-quotes)