I want to export a jar with maven <packaging>jar</packaging>. And after adding dependency to that jar in another project, I can import the macros.
How to do that?
EDIT:
With java, I can export com.example.a to a jar file, and use it in com.example.b with import. I want the similar for freemarker.
I've search with keyword package, bundle, export, module without any luck. I thought this should be a very common senario. I really do not know how to elaborate more.
If the TemplateLoader of your Configuration sees those resources, you can just #import/#include them, as you did before. Usually you need a MultiTemplateLoader, then add your "normal" TemplateLoader to it (which loads the application-specific FTL-s), and also a ClassTemplateLoader that points to the package which contains the reused FTL-s.
Related
In build.gradle files you can use File directly like
def file = new File("file.txt")
And even if you import java.io.File manually ide says it's unused
But at the same time ide says that File is java.io.File class
I wonder what approach was used to achieve this behavior
I think it is feature of Groovy language itself as it imports some java packages by default without needing to specify it:
https://groovy-lang.org/structure.html#_default_imports
Gradle builds on the standard java File class, so there is no need to import.
quote from docs:
In order to perform some action on a file, you need to know where it is, and that’s the information provided by file paths. Gradle builds on the standard Java File class, which represents the location of a single file, and provides new APIs for dealing with collections of paths.
More information, Check Working with Files at gradle official docs.
Let's say, I want to add a code-autogenerator for my gem/library. A code generator won't be a single executive cli file, but it'll contain source code as well as a cli file, and I'll be working on it too along with the main gem. Besides, it'll be written in a different language. I could move it into a different repository, but for now I've chosen to use a single repository. According to the convention, in what sub-directory in the main repository should I create that sub-project? opt, var, extra, tools....?
There is more likely no convention for a such situation and I think you already know the actually good solution: use a separate repository.
If this solution is not acceptable for now, a good option would be to put it in the folder with a name explaining its purpose. E.g. if it's a code generator, it could be inside "code_generator" or "tools/code_generator".
I want to run soapui with Maven, but has problem here and can't find any solution on the internet, want to know: How to overrides testCaseProperties just like projectProperties or testSuiteProperties in pom.xml file?
Reference: https://github.com/redfish4ktc/maven-soapui-extension-plugin/wiki/Tips
Screenshots as here:
Screenshots
The Maven plugin you link to clearly doesn't support that. Then I believe you are limited to the options given by the command line interface.
https://www.soapui.org/test-automation/running-from-command-line/functional-tests.html
From that, my guess would be that you can't. Not by only using this.
However, you may consider creating some sort of setup script for your TestSuite, that reads a project property, which can be set from the commandline. That one property may then be path and name for some sort of input file, and the script can then read it, and import any setting you have specified within to set any variables you may wish.
When I create a spring project in Eclipse, I specify the top-level package name
com.myapp.controller
but, it instead creates the package
com.controller.controller
I am Korean so I'm sorry I didn't explain it very well.
Thank you for helping me out. Even though we don't know each other,
Thank you for reading. If you know about this problem, help me ^^
You probably went ahead and created a Class without giving it a package name. This takes some doing, since the New Class Wizard actually populates the "package" field with the name of the project under the assumption that that's probably what you wanted to begin with.
So you have several options here:
Create a new class with a proper package name. Eclipse will then create the package structure for you and you won't have to lift a finger worrying about packages.
Create the package you want, perhaps even with a package-info.java file in it. Then create a class inside it.
Continue using the default package and live with the shame. (Just kidding. That's not a very good option. But if you're just fiddling around it won't hurt too much.)
The reason Eclipse doesn't just ask you what to name "the package" is that there could well be more than one. It's quite common for a project to have several packages in it. So instead, Eclipse makes creating packages easy.
Detailed Information: https://www.eclipse.org/forums/index.php/t/983472/
Here's how I usually develop an application:
I start with having all the code in a single source file.
When it grows enough to be modularised, I break the code into several modules.
When the modules grow enough, I split them again. And so on, iteratively.
Over time, some modules get shrunk, deleted or merged with others.
This workflow implies the need to move source files between modules sometimes. And here comes the problem:
When I move a module to another location, it changes the module's name, so I have to walk through all the other files renaming imports by hand.
Is there some organisational technique to avoid that annoying procedure? Or is that the way it goes and I just have to look into some automation utilities instead?
you can create a *.all module that public imports all modules in the package
then you only need to add/remove the module names from that module
You can override module name via module packagename.modulename; directive in the beginning of the module. It will need a help from the build system though as rdmd uses module names from import statements to form file system path to search for their sources. But if you will supply all source files project consists from by hand, it should resolve module names just fine.
It's better to define your entities before you start coding. You can use some modelling language to identify and write your entities. For example if you are using java to code your application then you can use UML to model this application.
Also, you have to separate buisness logic from data.
If you continue to do it like today you will lose a lot of time just dealing with filenames.