I'm using the maven-bundle-plugin and trying to bundle Google maps dependency.
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-ClassPath>*;scope=compile|runtime</Bundle-ClassPath>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Embed-Directory>OSGI-INF/lib</Embed-Directory>
<Import-Package>
*
</Import-Package>
<_exportcontents>
*
</_exportcontents>
</instructions>
</configuration>
</plugin>
When I inspect the JAR (Manifest.MF) I can see com.google.maps.model in Export-Package but not in Import-Package. How can I get it in the Import-Package as well?
This question is linked to a previously unresolved question How to import a class from third party jar file in an OSGi component
Well, there shouldn't be anything in the Import-Package here, as you're not importing the google maps classes, you are embedding them. You're packing the google jar inside your own bundle, and Import-Package applies only when you want to use those classes exported from another bundle.
As of the other question, I'm not entirely sure (I don't use the maven bundle plugin at all) but the 'exportcontents *' seems suspect, exporting too much can lead to subtle problems.
I'd say start by exporting nothing and add packages as needed.
If you are embedding the jar in your bundle and want to access its classes, use the Include-Resource instruction, it has an option to unroll a JAR resource (see # option)
Related
I've installed the checkstyle-idea (v8.16) for IntelliJ, there are two options of Configuration files, 'Sun Checks' and 'Google Checks'.
Is there a specific file for Cactoos project? Because both default options are not working when I check all the project, it returns a tone of error style from the source that is already committed at origin/master
Thank you
No, there isn't.
Cactoos uses qulice for static code analysis in its maven build.
Furthermore, Qulice aggregates several analyzers - not just checkstyle - with custom configuration (and checks in some cases).
So even if you installed plugins for all the analyzers that qulice aggregates (checkstyle, findbugs, etc), you'd have to somehow import those custom checks as well.
I have a maven repo with custom checks which I want all the other maven repos to depend on. I want to suppress checks for some generated code in one of my repos. There are 2 ways I can setup suppression file:
Have suppression file in the custom check repo, then specify SuppressionFilter in custom check style xml:
<module name="SuppressionFilter">
<property name="file" value="${samedir}/checkstyle_suppressions.xml"
default="src/main/resources/checkstyle_suppressions.xml"/>
</module>
Then in the maven plugin section of the pom.xml file of repo that I want to run custom checkstyle on:
<suppressionsLocation>checkstyle_suppressions.xml</suppressionsLocation>
<suppressionsFileExpression>checkstyle.suppressions.file</suppressionsFileExpression>
Do not put the SuppressionFilter section in the custom checkstyle xml. Have the same pom.xml setup for the repo to be checked. The suppression file can be placed local to the repo to be checked.
Both of the approach work with command line "mvn clean validate". But neither works with CheckStyle IDEA plugin for Intellij. The Intellij plugin complains it couldn't find the suppression file for the 1st method above.
I don't want to force every repo to have a suppression file if they don't need it. I wonder if there is a way to make suppression work for CheckStyle IDEA without having to have multiple copies of the same suppression file (1 in custom check repo, 1 in local repo).
Thanks!
The logic the plugin uses is
does the file path resolve?
does the file path exist relative to the rules file?
does the file path exist relative to the module content roots, the module file or the project base directory?
If not, it gives up. So there's two possibilities:
there's a bug in the logic. Raise an issue on GitHub please.
it doesn't fit your use case. Raise a feature feature on GitHub, with a example to reproduce the problem and how you think resolution should be changed to fit your needs.
The code's in the resolveAssociatedFile method of https://github.com/jshiell/checkstyle-idea/blob/master/src/main/java/org/infernus/idea/checkstyle/model/ConfigurationLocation.java if you're interested.
I have got a library project (written in ActionScript), that has two build outputs: One is made by including library A, the other is made by including library B.
My goal is to mavenize this library, and I've come up with the following solution:
I have a multi module Maven project that looks like this:
myLib-Mobile
\- pom.xml
myLib-Web
\- pom.xml
src
\- main
\- actionScript
...code is here
pom.xml
The parent pom.xml holds everything except the one dependency that changes based on the build target (and the FlexMojos compiler, since one needs to be built with AIR the other with Flash). Since the code is not at the usual location I define it this way in the pom files of the children:
<build>
<sourceDirectory>../src/main/actionscript</sourceDirectory>
...
This works fine if I build it in the console, but when I import this as a Maven project in IntelliJ, it does not find the source files - it seems to me that IntelliJ cannot handle if the <sourceDirectory> tag has a reference to the parent directory. The only workaround I found was to manually specify the content root in the project settings.
Anyone knows a better solution? Maybe using modules is not the way to go?
I recently took much of my reusable code and compiled them into SWCs for organization and ease-of-use purposes. Since doing so, none of my documentation has appeared in the code hints that Flash Builder provides. I have searched through project settings and I have been unable to find a setting for such a feature, and I am at a loss as to why it doesn't work anymore.
I compiled the SWCs using Flash Builder's Build Automatically functionality. I have not tried compiling with ANT yet, but will probably try the next time I build. asdocs was able to compile full documentation for all of my libraries with relative ease and the code hinting works if I use the raw AS files themselves, so I do not believe it has anything to do with the way I was writing the documentation. Example:
/**
* <p>Batch adds variables from a generic object using name-value pairs</p>
* #param variables A generic <code>Object</code> that contains name-value
* pairs that will be used as the arguments of the REST request
*/
public function addVariables( variables:Object ):void {}
Any idea why the code hinting no longer works?
Flash Builder uses ASDocs, which are embedded inside the SWC, to provide code hints - unfortunately, FB doesnt include the docs when it builds a SWC.
However, it can be done 'manually' with ANT:
<target name="insertASDocs">
<zip destfile="PATH_TO_YOUR_SWC" update="true">
<zipfileset dir="ASDOCS_FOLDER/tempdita" prefix="docs">
<include name="*.*"/>
<exclude name="ASDoc_Config.xml"/>
<exclude name="overviews.xml"/>
</zipfileset>
</zip>
</target>
PATH_TO_YOUR_SWC is the relative path and swc name (eg: myFolder/mySwc.swc).
ASDOCS_FOLDER is the folder where your generated docs are stored.
The ANT script just adds the ASDocs to the SWC - after this, code hints should appear.
Update:
Forgot to mention that you need to set keep-xml to true when generating the docs (if inserting them into a swc):
<asdoc keep-xml="true" ...
I'm using the Maven Appassembler plugin to package my application. I'd like to package some configuration files with the application. I've found the configurationDirectory and includeConfigurationDirectoryInClasspath parameters, but I haven't found how I should create (and populate) that configuration directory. I've tried putting the files in src/main/resources, but that just puts them in the jar file for my project.
What is the "proper" way to do this, using maven?
Unfortunately this is a limitation of the appassembler plugin in the current release version. Typically, the plugin is used in conjunction with the assembly plugin to produce the final artifact, in which you can include the reference to your configuration directory. However, if you'd like to have a functional structure from just the appassembler plugin you need to manually copy the files into place. An example using the antrun plugin with a src/main/conf directory can be found here: http://svn.apache.org/viewvc/archiva/trunk/archiva-jetty/
By default, the plugin uses the directory src/main/config.
Is possible to change the source for the config files using the parameter <configurationSourceDirectory>src/main/config</configurationSourceDirectory>
When I include the copyConfigurationDirectory property, it copies the config files and bundles them properly.
<configurationDirectory>etc</configurationDirectory>
<configurationSourceDirectory>src/main/config</configurationSourceDirectory>
<copyConfigurationDirectory>true</copyConfigurationDirectory>
I have a different problem though. I would like to filter my config files before copying, which is giving me some trouble.
Apart from that is does not generate the bin scripts for different platforms. The maven-assembly-plugin can create (package(s) {tar.gz, zip}) for distribution. These are configured through a assemble.xml. You specify which files go in (with what options (chmod)), etc. It can also filter files (search/replace values within them). etc.
Years later and in version 1.10 of the plugin there is now a preAssembleDirectory configuration option. Unfortunately I don't find it flexible enough for my needs because it copies directly into assembleDirectory and does not allow to specify a target directory path within assembleDirectory.