Previously I was able to get the version number since the version was stored as a property that was easy to grep and parse from the command line (bash). Now that the pom.xml element is used for this, it no longer is unique since all the dependencies and maybe some others too use this. I think there is no way to get the current version number with a bash script without external tools for parsing XML or some very context-aware sed command.
The most clean solution in my opinion would be for Maven to hand out this version information. I was thinking of writing a custom maven plugin for retrieving different properties but I thought I'd ask here first.
Which gives me the current version that I can then advance. Grepping might be simpler but I thought I'd like as robust as possible, so I'm satisfied with the first line that starts with a number and try to handle this as a version number.
(not available anymore)"The Unix Way"(ii) Expect the output of every program to become the input of another, as yet unknown, program. Don't clutter output with extraneous information. Avoid stringently columnar or binary input formats. Don't insist on interactive input.What does it actually mean?Your output should be:
Honesty I think Dave Copeland was right when he said that maven does't play fairly with others. So I decided to give a look to maven's source code as well as to maven-help-plugin's source code as well. It seems that they have fixed a little bit the maven's -q switch (I was using version 3.5.3 at that time), so now if you pass it, you won't get all the annoying non-sense logging stuff that prevents maven from being used within automated scripts. So you should be able to use something like this:
The problem is that this command prints nothing because by default the help plugin outputs through the logger which has been silenced by the -q switch. (latest available version of the plugin at that time was 3.1.0 released on June, 3rd 2018)
Why not use the right tool for the job? Using xpath syntax is the best approach to retrieving the version number, since it is the intended method of accessing a XML data structure. The expression below is traversing the pom using the "local name" of the elements, in other words ignoring namespace declarations which may or may not be present in the xml.
As long as you have python 2.5 or greater, this should work. If you have a lower version than that, install python-lxml and change the import to lxml.etree. This method is quick and doesn't require downloading any extra plugins. It also works on malformed pom.xml files that don't validate with xmllint, like the ones I need to parse. Tested on Mac and Linux.
If you don't mind to write the version into a temporary file, there is another solution (without grep/sed) that works well for me. (EDIT: see rjrjr's answer for a much simpler solution without any temporary file hassle)
I use the Exec Maven Plugin along with the echo binary. In contrast to the Maven Help Plugin, the Exec Plugin allows output redirection into a file, which can be used to bypass grep/sed, and makes it even possible to parse strange things like multiline version strings (with CDATA block in version tag), at least to a certain extent.
One last note here.. I found out tr was still resulting in things like /r/n0.3.2 (again only when running via Jenkins). Switched to awk and the problem has gone away! My final working result
I've recently developed the Release Candidate Maven plugin that solves this exact problem so that you don't have to resort to any hacky shell scripts and parsing the output of the maven-help-plugin.
On top of all the above, Release Candidate also allows you to set the version of your project (which is something you'd probably do on your CI server) based on the API version you've defined in your POM.
Either you have mvn give you the answer (as most answers suggest), or you extract the answer from the pom.xml. The only drawback of the second approach is that you can very easily extract the value of the tag, but it will be meaningful only if it's literal, that is, not a Maven property. I chose this approach anyway because:
"declaration": true - This enables generation of the .d.ts files that API Extractor will analyze.By design, TypeScript source files are not directly analyzed, but instead must be first processed by your compiler.
"declarationMap": true - This enables generation of .d.ts.map files that allow API Extractor errors to bereported using line numbers from your original source files; without this, the error locations will insteadrefer to the generated .d.ts files.
We recommend to use this template for your real config file. However, since the template is fairly verbose,in this tutorial we will show condensed files without the extra comments.This page explains each setting in depth.
Strictly speaking, JSON was originally intended as a machine interchange format, and thus does not formally supportcode comments. Recently JSON has gained popularity as a human-edited config file format, which obviously requirescomments. As such, most serious JSON libraries can handle comments without any trouble. (A notable exceptionis JSON.parse(); don't use that -- it cannot validate schemas and has poor error reporting.)
In the next few pages, we'll look at the individual settings in more detail. For now, we should simply make surethat the mainEntryPointFilePath matches the "typings" field in our package.json file above. The templateassigns it like this:
When API Extractor invokes the compiler engine to analyze your project, it uses its own TypeScript version. Itcannot use your toolchain's version because the compiler engine API may be incompatible. This sometimes causesAPI Extractor to report compiler errors due to differences in the system typings between TypeScript versions.You can avoid this by specifying the --typescript-compiler-folder command-line option(IExtractorInvokeOptions.typescriptCompilerFolder in the API). This enables API Extractor to usethe system typings from your toolchain's TypeScript folder.
If the issue is that your toolchain uses a newer compiler release than API Extractor's engine, pleaseopen a GitHub issue requesting to upgrade API Extractor's compiler. We try to stay as current as possible.
If you invoke API Extractor multiple times for a single tsconfig.json environment, this approach also allowsyou to reuse the same CompilerState object across multiple invocations. This can be a significant performanceoptimization, since the TypeScript compiler analysis is relatively expensive. Take a look at theapi-extractor-scenarios/src/runScenarios.tstest runner for a real world example of how to do this.
The api-extractor.json file contents are completely described by the IConfigFile interface, which youcan use to construct the ExtractorConfig object. With this approach it's possible to avoid creating anapi-extractor.json file entirely, but we generally recommend not to do that. When developers aretroubleshooting problems, it's very useful to have your actual configuration represented in a standard config filethat people can inspect and tinker with. Also, if you ever need to debug API Extractor itself,it's probably easer to debug the isolated api-extractor process than a complex toolchain, but you'll need anapi-extractor.json file for that.
So... if you work in a modern monorepo with many different projects, how can you ensure they have consistentAPI Extractor settings without a lot of copy+pasting of api-extractor.json files? Following theconvention of tsconfig.json and tslint.json, API Extractor supports an "extends" field that allowsyour api-extractor.json file to inherit its configuration from a shared template file.See here for details.
Samplers perform the actual work of JMeter. Each sampler (except Flow Control Action) generates one or more sample results. The sample results have various attributes (success/fail, elapsed time, data size etc.) and can be viewed in the various listeners.
This sampler lets you send an HTTP/HTTPS request to a web server. It also lets you control whether or not JMeter parses HTML files for images and other embedded resources and sends HTTP requests to retrieve them. The following types of embedded resource are retrieved:
If you are going to send multiple requests to the same web server, consider using an HTTP Request Defaults Configuration Element so you do not have to enter the same information for each HTTP Request.
Or, instead of manually adding HTTP Requests, you may want to use JMeter's HTTP(S) Test Script Recorder to create them. This can save you time if you have a lot of HTTP requests or requests with many parameters.
If the request requires server or proxy login authorization (i.e. where a browser would create a pop-up dialog box), you will also have to add an HTTP Authorization Manager Configuration Element. For normal logins (i.e. where the user enters login information in a form), you will need to work out what the form submit button does, and create an HTTP request with the appropriate method (usually POST) and the appropriate parameters from the form definition. If the page uses HTTP, you can use the JMeter Proxy to capture the login sequence.
If the request uses cookies, then you will also need an HTTP Cookie Manager. You can add either of these elements to the Thread Group or the HTTP Request. If you have more than one HTTP Request that needs authorizations or cookies, then add the elements to the Thread Group. That way, all HTTP Request controllers will share the same Authorization Manager and Cookie Manager elements.
Additionally, you can specify whether each parameter should be URL encoded. If you are not sure what this means, it is probably best to select it. If your values contain characters such as the following then encoding is usually required.:
b1e95dc632