Tycho Target Platform - Use directory - tycho

How can I get around the limitation in Tycho 0.18.0 that it is not possible to use a directory in my target platform? I can't access the internet so I need have my repository in local file system.

You can use artifacts in the local file system - they just have to be in a p2 repository format. (Background: Tycho requires p2 metadata for the build, and the folders used for the target file location type "Directory" don't contain p2 metadata.)
Once you have a p2 repository locally, you can for example reference it from a target file with a "Software Site" location and a file: URL.
If you are only temporarily disconnected from the internet, you don't need a special setup to work offline. Instead, you can just run your build once while offline, and then activate the offline mode via the -o Maven command line switch. Tycho will then simply use the artifacts it has cached in the local Maven repository.

Related

Adding External Files to Mulesoft AnyPoint Studio

I have a simple Hello World project in AnyPoint Studio. I have folder of additional files (a few jar files and some configuration files) I want to include with the project so they can get published to the cloud (CloudHub). How do I include these files into my project so when I publish my application the additional files are packaged with them.
Part 2 - Say I have a json file I want to read from my Mule application. What path do I reference the json file with after it is published?
Mule 4 projects are Maven based. You need to reference those jar files as Maven dependencies. You might need to install those projects in your local Maven repository. Search for Maven tutorials if needed. Ideally those JAR files are available in Maven repositories and you add only the dependency snippet in your pom.xml. If you are building yourself you can use mvn install command. If they are third party JAR files that you have the file only you have to use the mvn install but you need to define the coordinates (groupId, artifactId, version) yourself, which is not ideal and Maven won't be able to do automatic dependencies resolution for those JAR files. See this answer for details.
In your source project resource files should be in src/main/resources. At execution time you don't need to add a directory. If you add the file in a subdirectory of src/main/resources you need to use the subdirectory name only.

maven repository and dependencies download

I've used standard maven command mvn clean install and according to logs (in the same console window) dependencies were loaded and artifacts were installed to my dedicated directory for maven repository P:\.m2\repository. Maven build process succeeded.
I'm using maven 2.2.1
Here is the problem. Repository directory is empty. What I'm missing?
Thanks.
Some reasons:
Someone deleted the folder (or it's content)
Maven installed the files in a different place
I suggest to run mvn again with the option -X. Running mvn clean -X should be enough to see the paths which it uses to locate dependencies (install will download many more files but we need to see only one).
Note: P:\ sounds like a network drive. Even if this is your home folder (i.e. not shared with other people), this isn't a very good idea since it will cause a lot of network traffic and make your builds slow and brittle (in case of network problems).
Did you change the repository location in your m2_install_dir/conf/settings.xml?
If not, try to locate your files in something like:
C:\Documents & Settings\your_username.m2
or C:\Users\your_username.m2
I think you are using something like gitbash and its stripping off the backslashes in your repo value. run maven install with -X. check if you have a directory called P:\.m2repository

How can I get Eclipse to use my IVY_HOME variable when downloading ivy dependencies?

My company uses extensive use of ivy to download dependencies. Some of these dependencies are huge (~500MB) and take a while to download from the remote repositories.
To build our application we have an ant script that will first resolve all the dependencies and the deploy to the server.
I have set an "IVY_HOME" environment variable so that all the dependencies are downloaded to D:\ivy_home instead of C:\Users\.ivy2\ - this is because D: is my SSD which is significantly faster, and it is where my local server directories are located - so copying files from ivy_home to the server is super fast.
But for some reason when I am using IvyDE plugin inside eclipse - it always wants to download a separate copy of all the dependencies and puts them into my C:\ which is causing several issues:
Local publishes from the ant script will not be picked up in eclipse since they are placed into a different location
Dependencies already downloaded in D: will not get picked up which makes the ivy Resolve inside eclipse much slower than it needs to be
The dependencies are in a slower drive in eclipse so performing searches, and executing these jars is also slower
How about creating symlink to replace the .ivy2 in Users to D? I've tried it on my own and it's looks working fine.
Open cmd as root, and then execute this line
mklink /d C:\Users\{username}\.ivy2 D:\.ivy2
I'd create an ivysettings.xml file and specify the location of my cache using the caches directive. See the following answer for example:
can I turn off the .ivy cache all together?
Why don't you set up IVY globally with the ivysettings.xml along with a property file.
This property file could have this:
ivy.default.ivy.user.dir=D:\ivy_home
For individual projects you could uncheck "enable project specific settings" for each IvyDE library management, so they would use IVY global settings, with one extra eclipse environment configuration.

Maven tries to download dependency despite it existing in local repository

I have an installed dependency in my local repository. The remote repository where the dependency came from is now down for some reason. When I try to compile the project Maven says that it can't resolve dependency. But why???
When you have these error, simply clean the _remote.repositories that indicate maven where the dependency comes from. You will find this file for each artifact inside your M2_REPO.
Maven will compare the local POM's timestamp (stored in a repository's maven-metadata file) to the remote. When maven does this depends on the updatePolicy that can be defined in your settings xml.
Either set this to never (discouraged) or skip this check (only when a remote repository appears to be down) by using the -o option (offline); then maven will not check remote repositories.

Getting lift sources from maven repository

I'm trying to learn how to use lift. I can create project skeleton by running maven commands (I had zero maven experience before) from Starting with Lift. It successfully downloads needed dependencies and everything works fine, however it does not download sources - I'd like to see how lift works from inside.
Looks like it downloads dependencies from here and there are compiled .jar files as well as sources - there are lift-mapper-1.0.jar and lift-mapper-1.0-sources.jar, but only lift-mapper-1.0.jar is downloaded to my local repository. I could download sources manually, but there are more than just few folders there. So, is there a way to tell it to Maven to download dependencies with sources?
The maven-dependency-plugin has a sources goal that will obtain the sources for all dependencies that are available. Simply run mvn dependency:sources to obtain the sources.
If you are using Eclipse, the m2eclipse plugin handles source resolution and attachment for you. You can set it to automatically obtain sources in the Maven preferences. Window > Preferences...->Maven, then enable Download Artifact Sources.
You can also manually invoke "Download Sources" action from the Maven popup menu on any jars (including those that are not managed with Maven). Then plugin will use Maven repository indexes to lookup the corresponding Maven artifact and download its sources.