Local non-mavenised SWC - maven

I'm working on a project that requires a very complex maven build.
One swc we use is just for native Flash assets. All our assets are versioned separately in another git repo so I just want maven to include it as a local lib.
Until now we have been continuously uploading the swc to artifactory with each change and versioning it there. As all assets are versioned separately anyway this is a superphlues and arbitrary system.
I would just like to have it in a local 'lib' folder and not be versioned through maven. And I don't want to have to install to the .m2 folder either as this will not automatically pick up changes to the local file as far as I know. I just want the swc to be treated as the code is.
Is there a workaround for this?
Thanks in advance.

Apologies, I realise I never came back to this.
I eventually decided I was trying to do something that was not an intended use case.
In the end we just absorbed the code into the main project.

Related

Can I use maven to add sources as part of my project?

I am using a dependency and I have some issues with it.
I could download the sources and include it as part of my project and then start modifying the source to help me debug my issue.
However, is there an easier way to do this, using maven ? I have the source-jars downloaded but I am not sure if I can then use these source jars and modify the code as well ?
I could in theory unbar the sources and add them to my source build path, but is there an easier way to accomplish this ?
I am using maven and IntelliJ.
Are you able to get a successful build of the dependency you're having issues with (in it's own project?).
If so, change the version, e.g. 1.2.3-CUSTOM-1, make the improvements, rebuild, and use it as a proper maven depdendency with <version>1.2.3-CUSTOM-1</version>.
This might seem a lot of work, but it's not really - you end up with a properly versioned jar.... having a "hacked" version of 1.2.3 jar is asking for all sorts of problems later.
On the plus side, you can share and deploy the -CUSTOM-1 jar if you need to, and you can keep versioning -CUSTOM-2, etc.
This is the "proper way" I would say.
As Thorbjørn Ravn Andersen wrote, source jars are read-only. You can setup debugger breakpoints in them, but you can't "write" in them
Either unjar the sourced jar or if you know it came from a git release tag, clone the original repository and checkout the correct tag
Make sure its sources compile
Bump up the version in case you know you are going to hack the source
On the right pane, use Maven projects / Plus icon to add sources and use the "m" Execute goal icon to build the sources in IDEA :

Location for 3rd party component that will be used during the build (gradle)

We have one project that reuses 3rd party war (it's shindig-server-2.0.2.war if anyone asks:). This war currently sits in project root and the current ant tasks unzips it into some temp folder, performs several changes (like applying fixes, modifies the web.xml etc.) and finally build the war from our sources and the war content. This 3rd party is checked into the source repo.
We are migrating to gradle. Where should we put this file in Maven directory structure?
It does not look it belongs to /src/main/resources as it is not packed withing the artifcat; also, imho it does not belong to /src, too. Should we have a /lib/resources folder in root where we could store such files?
I don't think the Maven directory structure defines a place for local dependencies, and since this is a Gradle build, it doesn't really matter either. I wouldn't put it under src, but lib sounds fine.

Maven war plugin copy arbitrary files

I apologize that this is surely basic maven/war plugin stuff, but I'm totally not a maven user. I just have to hack this one thing into a project that is maven based.
What I need to do is to copy an (essentially arbitrary) directory and files into the root of my war. I need them to appear as resources available via HTTP when the war deploys.
I cannot simply put them in the "right place" in the source tree. This is because the files in question are actually the source files of my project. I realize this is a bit odd, but this is a documentation project, and I need to show the source and the effect all in the same war.
So, in the general case, how would I configure the maven war plugin to copy a given directory, along with it's contents, to the root of my war? (BTW, I have tried to make sense of the documentation of this tool, but it seems to be predicated on so much understanding of maven that it feels like I'll never understand it without learning maven first, and I'm a bit too pressed for time to do that just now!)
Many TIA
Toby.
You could try:
use the copy-resources plugin. Use the plugin to copy your source files under target prior to when the war is packaged.
or, configure the maven-war-plugin to include additional resources.
Thanks Drew, that got me where I needed to go. Bottom line, I added the sample pom fragment from the link you gave for copy-resources to my pom.xml with the following changes:
<outputDirectory>target/${project.name}-${project.version}/sources ...
<directory>src/main/java ...
I copied this from the link you gave, then edited the element to point at src/main/java, which picked up my files, and the outputDirectory to the aggregate target/${project.name}-${project.version}/sources . I found that ${project.name} mapped to the project, and the version came from ${project.version}, which seemed to resolve the last little bits of issue.
Thanks again.
Toby

Exclude Reading/Replacing specific files in Maven Build

We are using maven for building the project. It's legacy and huge one.
We newly added few .keystore files to it's resources folder.
The problem is, once the build is done, the .keystore files are getting tampered [may be maven is trying to replace/search for some placeholders]. Since it's legacy one, the project structure is so much messed up and we don't have separate distributions or no other choice but to go with plain build.
What I want is, tell maven to copy these sort of files without touching them and keeping the build as usual like before.
Between, there's no explicit is mentioned in pom.xml, tried to doing with that as per this http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html but it's messing up the project build.
I don't want to tamper the build, since it's legacy and huge one. We are using Ant plugin
Just switch off filtering for the respective <resource/> or add an <exclude/> for it.
After going through lot of sources, Found the solution http://maven.apache.org/plugins/maven-resources-plugin/examples/binaries-filtering.html
Thanks :)

Xcode, update project file automatically

I have many projects that use a bunch of exact same class.
Is there a way to add a script to Xcode, so, each time i compile, he go to a network folder and update is files from there... If newer. (i do this step manually, but could be great to automate it)
Thanks
You could add a "run script" build phase to copy over files before compiling if that's really what you want to do. That would catch updates for you but I don't think it would help you if new files are added (though copying them into a location your project has a folder reference rather than a group pointing to might work).
That said I think there's a better solution. It sounds like you're reinventing a process for managing project dependencies when you could use existing tools. I would publish those shared classes as a library and add it to each project using CocoaPods and a reference to the library's git repository. That way you just need to run a pod install to get the latest version of your library. A good dependency manager gives you a clear understanding of which version of your dependencies you're currently using, control over when to update them, handles installing dependencies of your dependencies, and will avoid link errors from multiple static libraries attempting to each include a copy of the same common dependency.

Resources