Export projects as .jar in IntelliJ - build

I've recently switched from Eclipse to IntelliJ, and i'm a bit confused as to how to export projects as .jars. I've seen other posts, where the answer is to go to File > Project Structure > Artifacts, and add a new build artifact, and then use Build > Build Artifacts. However, I don't know where the jar is being saved, (if it is) and I would also like to know how to make it export to a custom location. I also think it's kind of strange how it takes IntelliJ around 20 or so seconds to compile the jar, while in Eclipse it only takes half a second.

You can also use "Build on make" option. IntelliJ will make new jar for you on each "make" invocation. Assuming there were changes. Otherwise it will keep the existing jar.
Also, "Artifacts" configuration screen contains the location of the artifact.

Related

Change eclipse's default launch configuration for all C/C++ projects

Although there might be questions on SO that appear similar to this one I assure you that none of those have been able to answer mine.
I've been figuring out a way to sort of "automate" (I guess you could say) my eclipse projects. To elaborate, let's say I create a C++ project in eclipse using the project creation dialog. This creates two (default) build configurations for the project (Debug and Release).
The annoyance I have run into is that when launching the project, every time I want to switch build configurations (i.e. Debug or Release) I have to manually change the path to the respective ".exe" in the project's launch config, which is rather cumbersome. (See image below...)
by replacing the "C/C++ Application" field with the following:
${config_name:${project_name}}/${project_name}.exe
The appropriate .exe is launched based on the currently active configuration. This is exactly what I was looking for.
Currently, however, I have to set the launch config this way for every C/C++ project I make since eclipse only generates a run configuration as seen in the image (which is not what I want). My question is, how can I make eclipse automatically produce this launch configuration for every C/C++ project I make?

MSBuild unnecessarily runs custombuild tool when run for different configurations

I have a C++ project for which I need to run a custom build tool on some header files to generate code that is required when compiling this project. In general my configuration works. I trigger a build, VS/MSBuild detects whether the output files are up-to-date and runs the custom build tool only if necessary.
However, a problem arises if the build is run in combination with another configuration of the same project. Both configurations depend on the output files of the custom build tool. So if run sequentially only one configuration should trigger the custom build tool to run. For which ever configuration a build is triggered second the output files of the custom build tool are already present and up-to-date. So there is no need to build them again. Unfortunately this is exactly what is happening. Since the custom build tool takes quite some time to run, this increases build times dramatically.
Another interesting aspect is, that once both configuration have run, I can trigger any of them again and the custom build tool is not invoked.
What I would have expected from the documentation is that the custom build tool is triggered:
If any of the files specified as Outputs is missing
If the file for which I specified the custom build tool was modified later than any of the existing files specified as Outputs
If any of the files I specified as Additional Dependencies were modified later than any of the existing files specified as Outputs
But all of this independent from the configuration for which the build was triggered.
Does anyone have an idea on why this might happen? I checked that the settings for the custom build tool are identical for both configurations. The output files are generated into the same folder for both configurations.
The documentation you're referring to is basically correct but it omits to say that everything in there is basically per project configuration/platform because it uses tracker.exe which depends on .tlog files which by default go into the intermediate directory. So as you figured out, making all configurations use the same location for the tlog files should keep the tracker happy and only invoke the custom build tool when needed, independent of configuration/platform. I'm not sure I'd recommend any of this though, sharing temporary object files might cause you problems later.
Another way to deal with this is adding a seperate project with just one configuration, say 'Custom', and do the custom build there. Than make your current project(s) depend on that project and in the solution's Configuration Manager adjust all entries so each configuration you have now builds the 'Custom' configuration for the new project.

Visual Studio C++ Adding Deployable Content(Entire Folder)

I am trying to add resource files to my Visual Studio C++ project, but my images do not seem to be copying correctly during the build step. When developing within a C# environment, this was easily achieved by right clicking on the resource file(an image or what have you) and editing the "Copy to output directory" option. This option does not seem to exist within the C++ environment. Here is a picture of the C# environment to better illustrate the option that I am looking for:
I tried doing roughly the same thing within the C++ environment but, like I said, the option simply does not exist. Instead it only gives a "content" option, with a "yes" or "no". The tool tip says that this is related to a deployment resource, however the resource is not deployed during the project build. I would also like the entire folder to be copied upon build; here is another picture:
Does anyone know how I can replicate this within a C++ environment?
EDIT
I tried using a post-build event script, but nothing appeared in the output directory. I am trying to copy the "Resources" folder, which I show in the second image. Here is the script that I am using:
xcopy "$(ProjectDir)Resources" "$(TargetDir)Resources" /e /y /i /r
Did I do something wrong in that? I don't even see any errors in the build log.
Your post build script worked for me. Yes, it is disappointing that the C++ project solution does not make doing so easier.
Add the project output to the installation project as content Files

Artifact dependency from the same build configuration in TeamCity

I'd like to setup a TeamCity build that will perform an incremental build.
For this, i want to store the build outputs (.dll files) as artifacts, and reuse them on every subsequent build (copy the latest artifacts to the build agent before starting the build).
This will effectively place the last build's artifacts in the project's output folder, so MSBuild could use those artifacts to determine whether it needs to rebuild anything from sources.
I've tried to do this, but it seems TeamCity doesn't allow configuring artifact dependencies from the same build configuration.
For example, if i have a "Build Plugins" configuration that generates a collection of plugin DLLs, i cannot use these as a dependency for the same build configuration...
Is there any inherent way to overcome this in TeamCity, or to create an easy solution myself?
It appears it is only possible to do this when using templates.
You can create a template for a build. Then you create a build from that template. After that you add this build to the artefact dependencies from the template. This allows for circular dependencies.
I have found no other way.
It looks like you can do this now! It seems to work in 9.0.1, and TW-12984 says it should work as far back as 8.1.

Project properties lost on external checkout

Our company might be moving from CVS to Subversion soon. This has brought about an issue for us, which I am trying to solve.
For CVS and Eclipse, we were able to use team project set files to gather various modules and check them out together (http://vpms.de.csc.com/projectset/). This made it very easy to manage projects, since there was no need to remember each module in the project.
However, project sets do not support SVN. I know there is an 'externals' property for SVN that does approximately (or possible exactly) the same thing. I tried this. Now, for the problem:
When I use the externals property and checkout 2 modules in eclipse, their C/C++ project properties are lost, and so I cannot right click on them to say "build project" or "clean project". They appear to Eclipse to be folders with files in them.
Is there something I am missing here?
EDIT
When I check out each module separately, they check out as projects, so they do have the individual .project/.cproject/settings stuff
You forgot to place Eclipse project metadata into your source control system. Make sure all files starting with '.' in project root make it in along with the entire contents of the .settings directory.
Subversion externals simply allows you to take files from one part of the repository and bring them in under a folder in your local checkout. At my last company, we had a java source directory that called "commonSrc" that was an SVN External for another project's main "src" directory, but in the project it was brought into, it simply acted as another folder (as you are experiencing).
I never really liked that method and wouldn't recommend it unless you have only one/two modules.
In order to do what you are trying to do with SVN, you might have to checkout each project separately, and use "Module Dependencies" in the project's properties to create the proper dependencies in Eclipse. You might be able to commit these project files so that the next person doesn't have to re-link them.
In case anyone needs this, here's what I found:
http://vpms.de.csc.com/projectset/
&
http://www.polarion.org/index.php?page=download&project=subversive
OR
http://www.giniality.com/old/update/projectset/
for Subversion + Project Set integration.
There is no need to break your project set. Once you have the integration plugins installed in Eclipse, all you need to do is change the source from the CVS server to SVN.