I'm having trouble while developping a maven plugin to find out how to configure the inheritedByDefault property to be set to false in the generated plugin.xml file.
Be careful, I don"t speak about the inheritedByDefault property of each mojo, but the general inheritedByDefault property at the root of the plugin tag.
Plugin descriptor documentation isn't very loquacious about this subject and I can't find anything on Internet.
Related
I am using Jacoco v0.8.4 and Sonarcube v2.7.1.
I am using the following configuration for SonarCube.
property "sonar.sources", "src/main/java"
property "sonar.binaries","build/intermediates/javac,app/build/tmp/kotlin-classes"
property "sonar.java.binaries", "build/intermediates/javac,app/build/tmp/kotlin-classes"
property "sonar.tests", "src/test/java" // where the tests are located
property "sonar.java.test.binaries", "build/intermediates/javac,app/build/tmp/kotlin-classes"
property "sonar.jacoco.reportPath", "build/jacoco/testDevDebugUnitTest.exec"
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.android.lint.report", "build/reports/lint results.xml"
The SonarCube analysis failed with reason as Invalid value for sonar.java.binaries
> No files nor directories matching 'app/build/tmp/kotlin-classes'
But 'app/build/tmp/kotlin-classes' exist in my project folder.
But, If I remove kotlin things from the property then it provides the coverage for Java files successfully.
Am I doing anything wrong for Kotlin coverage?
you also need to add you build variant folder in pathlike below
property "sonar.java.test.binaries", "build/intermediates/classes/test/, app/build/tmp/kotlin-classes/<BuildVariant>UnitTest"
property "sonar.java.binaries", "build/intermediates/classes/<BuildVariant>/, app/build/tmp/kotlin-classes/<BuildVariant>/"
property "sonar.binaries", "build/intermediates/classes/<BuildVariant>/, app/build/tmp/kotlin-classes/<BuildVariant>/"
and one more thing try to avoid using file name with whitespace like lint results.xml
I am including security definitions in pom.xml file. When I run a goal mvn compile, it throws an exception:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.github.kongchen:swagger-maven-plugin:3.1.2:generate (default) on project test: com.fasterxml.jackson.databind.JsonMappingException: No content to map due to end-of-input
I have included security definitions in Swagger Maven plugin as below
<securityDefinitions>
<securityDefinition>
<json>src/main/resources/securityDefinition.json</json>
</securityDefinition>
</securityDefinitions>
I have tried with ${basedir} but still get the above exception. How can this be resolved also as the spec says?
The file will be read by getClass().getResourceAsStream, so please note the path you configured. How can I fullfil this condition?
You need to wait to next plugin release (3.1.6). They just merged the changes to the master branch with the solution to the classpath file loading problem that you are facing. The classloader used when the plugin executes has no access to the project's files, be it resources or Java source files.
Next release will have a <jsonPath> tag to allow access to file location and <json> tag for classpath file loading (solving the problem).
Update (tested):
If you don't mind about it you can use the 3.1.6-SNAPSHOT version.
Then, in your POM:
<securityDefinitions>
<securityDefinition>
<jsonPath>${project.basedir}/securityDefinition.json</jsonPath>
</securityDefinition>
</securityDefinitions>
And in the JSON file follow the author's intructions:
https://github.com/kongchen/swagger-maven-plugin
I am following the steps given in
http://www.tutorialspoint.com/struts_2/struts_quick_guide.htm
for a sample struts 2 application
but I am getting following error message :
Can not find the tag library descriptor for "/struts-tags
I followed several helps :
Error - Can not find the tag library descriptor for "/struts-tags"
Cannot find the tag library descriptor for /WEB-INF/struts-html.tld in Struts
still the error persists.. what shall I do?
Thanks
This message can be produced if the struts2-core-[VERSION].jar is not marked as an Export Dependency.
To correct this:
Project Properties > Java Build Path > Order and Export
Then mark struts2-core-[VERSION].jar as an Export Dependency (or, if included via Ivy, make sure the Ivy library is marked as an Export Dependency).
Have you added the struts2-core-.jar to the libraries of the project? Clean the project. The error will go away.
I have a simple Eclipse Plugin which gives me following error on activation:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [bundleresource://103.fwk8918249:1/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [bundleresource://103.fwk8918249:4/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
both URLs resolve to the exact same jar in the bundle
libs/slf4j-log4j12.jar!/org/slf4j/impl/StaticLoggerBinder.class
How can i solve the problem?
How come that the bundle loads the jar twice (":1" and ":4")?
This is a result of defining an SLF4J binding in both your project's classpath (JDT .classpath file) and your MANIFEST.MF file.
You should remove your SLF4J binding from your project's class path:
YourProject → Properties → Java Build Path → Libraries
Select the SLF4J Binding JAR and hit 'Remove'.
Once you do this, there should only be a single reference to your SLF4J binding in your class loader (and thus the error message should not appear).
For me the issue occurred due to an installed plugin. To find out which one it is.. look for the file SavedExternalPluginList.txt in the metadata of the debugging eclipse instance, e.g.
runtime-EclipseApplication\.metadata\.plugins\org.eclipse.pde.core\SavedExternalPluginList.txt
and search for slf4j. This way you get an idea which plugins might be responsible. I found following entries:
file:/D:/EclipseJava/App/Eclipse/plugins/ch.qos.logback.slf4j_1.0.7.v201505121915.jar
file:/D:/EclipseJava/App/Eclipse/plugins/org.eclipse.m2e.maven.runtime.slf4j.simple_1.7.0.20160603-1931/
file:/D:/EclipseJava/App/Eclipse/plugins/org.slf4j.api_1.7.2.v20121108-1250.jar
file:/D:/EclipseJava/App/Eclipse/plugins/org.slf4j.impl.log4j12_1.7.2.v20131105-2200.jar
Disabling the plugin ch.qos.logback.slf4j for my Target Platform did the trick:
If you manually change the plugin selection, please be careful and use the Validate Plug-ins feature to make sure you don't create other issues.
This seems to solve the problem:
SLF4J: Class path contains multiple SLF4J bindings
If not, do you have two different versions of SLF4J on that path?
I have many jar files in my directory:
some-lib-2.0.jar
some-lib-2.1-SNAPSHOT.jar
some-lib-3.RELEASE.jar
some-lib-R8.jar
some-lib-core-1.jar
some-lib-2.patch2.jar
some-lib-2-alpha-4.jar
some-lib.jar
some-lib2-4.0.jar
How can I get library name and version from file name?
Is regex ((?:(?!-\d)\S)+)-(\S*\d\S*(?:-SNAPSHOT)?).jar$ valid for extract name and version?
The version number in the JAR file name is merely a convention and a default for Maven-built JARs. It may have been overridden, and it is not always reliable reading the version number from just the file name.
A more reliable way for reading version number from JAR is to look inside the JAR file. Here you have a couple of options depending on how the JAR was built:
look at META-INF/maven/.../pom.properies and pom.xml and read the version from that - this should be present for Maven-built binaries
sometimes version number if present in META-INF/MANIFEST.MF under Specification-Version or Implementation-Version properties
If this fails, then fall back to reading version number from the JAR name since there is no other information available.
Naming policy could differ across different libraries, so you aren't able to extract name/version from package name using one rule, for details you should check project docs.
In case of Maven you are able to configure the final name of built artifact with finalName pom.xml configuration option. Maven docs provide nice introduction into pom structure. Below is the example from docs:
<build>
...
<finalName>${artifactId}-${version}</finalName>
...
</build>