-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add bndtools workspace template fragment
- Loading branch information
1 parent
807bd8e
commit f8ae7d4
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Tycho Workspace template fragment for bndtools for pomless Maven build | ||
|
||
The is a [bndtools template fragment](https://bnd.bndtools.org/chapters/620-template-fragments.html) which you can use in a new or existing bndtools workspace, | ||
to add a Maven build based on Eclipse Tycho for your bnd workspace. | ||
|
||
All it does is adding a `.mvn` folder to your bnd workspace, contain a `extensions.xml` and a `maven.config`. | ||
|
||
See documentation for the [Tycho BND Plugin](https://tycho.eclipseprojects.io/doc/main/BndBuild.html) for more information. | ||
|
||
## Building your workspace | ||
|
||
``` | ||
cd mybndworkspace | ||
mvn clean install | ||
``` | ||
|
||
This should be all you need to build your bnd workspace with Maven / Tycho. | ||
|
||
It will automatically consider all `bnd.bnd` files. | ||
|
||
|
||
## Optional parent pom.xml | ||
|
||
While the default build is pomless, you can create a parent `pom.xml` in you `cnf` folder. | ||
It can be as simple as that: | ||
|
||
```xml | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.example.mygroup</groupId> | ||
<artifactId>parent</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
<packaging>pom</packaging> | ||
</project> | ||
``` | ||
|
||
This is useful if you want to add other maven plugins to your build e.g. for code analysis or reporting. | ||
|
||
## Creating executable jar based on .bndrun files | ||
|
||
Tycho can also create an executable .jar file of your application based on the `.bndrun` file containing `-runbundles`, which you can then deploy and start. | ||
|
||
Just add the following line to you `.mvn/maven.config` file: | ||
|
||
``` | ||
-Dbndrun.exports=mydemo.app | ||
``` | ||
|
||
This automatically searches all your bundles for a file named `mydemo.app.bndrun`. | ||
|
||
If you have a bundle `myappbundle` which contains `mydemo.app.bndrun`, then the build would create an executable jar at: | ||
|
||
`/myappbundle/target/executable/mydemo.app.bndrun.jar` | ||
|
||
Your build output looks like this: | ||
|
||
``` | ||
[INFO] --- tycho-bnd:4.0.11:run (build) @ myappbundle --- | ||
[INFO] Exporting mydemo.app.bndrun ... | ||
[INFO] Exported to .../myappbundle/target/executable/tycho.demo.app.jar | ||
``` | ||
|
||
|
||
## Additional properties | ||
|
||
Note: All properties in .mvn/maven.config can also be supplied via command line, for example to use a different tycho version use: | ||
|
||
`mvn clean install -Dtycho-version=5.0.0-SNAPSHOT` | ||
|
||
This uses the snapshot build which is e.g. useful if you build tycho yourself on your local machine and want to test that build. | ||
|
||
|
||
## polyglot.dump.pom | ||
|
||
E.g. `-Dpolyglot.dump.pom=pom-gen.xml` specifies that the generated pom.xml files which tycho polyglot creates is called `pom-gen.xml`. | ||
This might be needed if you have name clashes with existing files in your build. | ||
|
||
|
||
## tycho.pomless.aggregator.names | ||
|
||
`-Dtycho.pomless.aggregator.names=_dummydisabled_` is for handling a rare edge case: | ||
In case you have your bnd workspace in a subfolder called one of `bundles`,`plugins`,`tests`,`features`,`sites`,`products`,`releng` then tycho can have problems. | ||
The reason is that those names are kind of 'magic' names reserved for special usecases. | ||
`-Dtycho.pomless.aggregator.names=_dummydisabled_` is a workaround to instruct Tycho to ignore those names. You can choose any word like `_dummydisabled_`, but just make sure you do not have a folder like this. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<extensions> | ||
<extension> | ||
<groupId>org.eclipse.tycho</groupId> | ||
<artifactId>tycho-build</artifactId> | ||
<version>${tycho-version}</version> | ||
</extension> | ||
</extensions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-Dtycho-version=4.0.11 |