I created maven project with command line:
mvn archetype:generate
-DarchetypeRepository=repo1.maven.org
-DarchetypeGroupId=org.codehaus.mojo
-DarchetypeArtifactId=gwt-maven-plugin
-DarchetypeVersion=2.3.0-1
Then I opened it in Intellij Idea 10.5, and received some errors from Maven Model Inspector:
Cannot resolve directory ''${webappDirectory}'' (at line 59)
Cannot resolve directory 'WEB-INF' (at line 59)
Cannot resolve file 'classes' (at line 59)
In spite of this the project compile and run normally. What is this?
Part of my pom.xml:
<build>
<!-- Generate compiled stuff in the folder used for developing mode -->
<outputDirectory>${webappDirectory}/WEB-INF/classes</outputDirectory>
. . .
</build>
in the beginning of your pom.xml file in the properties section there should be this tag:
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
That's where the ${webappDirectory} "variable" is defined.
When you place the cursor over the text inside the brackets and press ctrl + q, you will see a small explanation for the variables (Intellj Idea specific)
${project.build.directory} = Model Property project.build.directory: ${project.basedir}/target
${project.build.finalName} = Model Property project.build.finalName: ${project.artifactId}-${project.version}
<outputDirectory>...</outputDirectory> configures where the compiled classes are put (As the comment above your snippet already says).
Have a look into your projectDir/target directory.
But I can't tell you what this means for development mode.
Btw. i've put <!--suppress MavenModelInspection --> above <outputDirectory> to get rid of the red mark in the editor.
Whoops, that seems to be a pretty old question :)
Guess you already know!
Regards
Related
I am using antlr4.3 (complete) jar.
It has many duplicates in org.antlr.runtime and org.antlr.v4.runtime packages.
In code when I explicitly use 'v4.runtime' - at runtime, classpath picks up 'runtime'.
So I extracted the jar and recreated it without org.antlr.runtime.
But apparently some classes like RecognitionException is now not found.
How should I resolve this other than:
Exploding the latest Jar and specifying org.antlr.v4.runtime BEFORE org.antlr.runtime so that a duplicate class will be picked up from v4.runtime, and if there isn't one in it, it will look at org.antlr.runtime...??
To add to the above, here's the code snippet which gives a problem: the jars are in the classpath.
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.ANTLRInputStream;
public class AntlrMain {
public static void main(String[] args) {
System.out.println("Start Hello World");
try {
InputStream is = new FileInputStream(
"/home/ecworkspace/antlrCentral/DSL/mydev.dsl");
org.antlr.runANTLRInputStream input = new ANTLRInputStream(is);
org.antlr.v4.runtime.CharStream cs = (org.antlr.v4.runtime.CharStream) input;
VCFGLexer lexer = new VCFGLexer(cs);
Initially in the ANtlrMain class, I wasn't using explicit
org.antlr.v4.runtime.; but that failed at runtime, with 'CharStream not found'.
Then I changed to include full path of the class
Then changed the ANTLR4 Jar to 'exclude' org.antlr.runtime (it has org.antlr.v4.runtime). That's when the 'RecognitionException not found' error occurred.
The grammar by the way, compiles OK, generating all my VCFG*.java and tokens classes, where VCFG is the grammar name.
UPDATE 1
Keeping in line with suggestions from all - I removed my answer to my own questions and adding it to this original questions.
In antlr-4.2-complete.jar, I see:
/tmp/x/ $ jar -xf antlr-4.2-complete.jar
/tmp/x/ $ ls org/antlr
runtime stringtemplate v4
/tmp/x/ $ ls org/antlr/v4
analysis codegen parse semantics Tool$1UndefChecker.class Tool$OptionArgType.class
automata misc runtime tool Tool.class Tool$Option.class
/tmp/x/ $ ## The 2 runtimes above: org.antlr.runtime and org.antlr.v4.runtime
/tmp/x/ $ ## which to use where, along with same-name classes in
/tmp/x/ $ ## org.antlr and org.antlr.v4
So, in build.xml, I use above jar to:
`
java -jar antlr-4.2-complete grammar.g4 => compiles and gives me
VCFG*.java and VCFG*.tokens
javac -cp "antlr-4.2-complete-jar" VCFG*.java => Succeeds. I have
the VCFG*.class collection.
Then I compile my code AntlrMain.java (which uses AntlrInputStream
etc.), again with the above antlr jar and some 3rd-party Jars
(logging, commons) => successfully.
Finally the RUN of java -cp "antlr-4.2-complete.jar:log4j.jar" -jar
myJar => FAILS on 'CharStream' not found.
UPDATE 2
Adding, based on your response.
I have only recently started posting questions on Stackoverflow. So pointers about whether to respond to my question to provide more info, or to comment to a reply etc. are welcome.
-cp <3rd-party> is -cp "log4j.jar:commonsLang.jar".
By -cp "above-jar" I meant -cp "antlr-4.2-complete.jar.
And if I have not mentioned it, it is an oversight - I have, for every 'java' and 'javac commands, included antlr-4.2-complete.jar.
BUT I see you indicating antlr-runtime-4.2.jar. So there ARE separate antlr-runtime jar and antlr-complete jars.
In the 4 steps below (I am leaving out -cp for convenience, but am including antlr-4.2-complete.jar for 'every' step.
I believe, I should be using the antlr-run-time and antlr-complete jars at different steps:
1 (java MyGrammar.java)
2 (javac MyGrammar*.java)
3. javac MyOwnCode.java
4. Run myCode (java MyCode) ...
which of the two antlr JARs (runtime and complete; and their versions) should I then use, at each of the above 4 steps?
The jar file does not contain duplicate classes. The code generation portion of the ANTLR 4.3 Tool relies on the ANTLR 3.5.2 Runtime library, which is included in the "complete" jar file. While some of the classes have the same name as classes in ANTLR 4, they are not duplicates and cannot be used interchangeably.
#280Z28 / Sam:
I am mortified, but have to admit the simplest answer is most often the correct.
I spent time fleshing out the JAR, making multiple JAR files out of it, include one for compile, one for run and on and on.
The answer is succinctly explain in the ANT build.xml code snippet below: where I produce the 'final' production JAR file, which is the only JAR then included while executing my Main program:
<jar destfile="${p_productionJar}">
<fileset dir="${p_buildDir}" casesensitive="yes">
<include name="**/*.class"/>
</fileset>
<zipfileset includes="**/*.class" src="${p_genCodeJar}"/>
<!-- How did I miss including p_antlrJar earlier?? -->
<zipfileset includes="**/*.class" src="${p_antlrJar}"/>
<zipfileset includes="**/*.class" src="${p_jschJar}"/>
<zipfileset includes="**/*.class" src="${p_log4jJar}"/>
<zipfileset includes="**/*.class" src="${p_commonslangJar}"/>
<manifest>
<attribute name="Main-Class" value="AntlrMain"/>
.....
The production Jar was missing ${p_antlrJar} => which is antlr-4.3-complete.jar!!!!
You did mention this in your answer... but it was a pretty silly mistake to do, and didn't think I had done it...
Thank you.
I am trying to configure my GWT project to run in SuperDevMode and experience severe problem during server run time.
So, I have working "regular" devMode configuration in Intellij IDEA. Created a new GWT configuration in app-servers list. Set the following values:
[Checked] Super Dev Mode
VM options: -Xmx512m -XX:MaxPermSize=384M
Dev Mode parameters: -bindAddress 0.0.0.0 -port 1234 -workDir d:\projects\myApp\SDV\ -src d:\projects\myApp\src\main\java com.app.MyApp
Made changes to my project's build xml file adding the lines in the end of file:
<add-linker name="xsiframe"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
<!-- enable source maps -->
<set-property name="compiler.useSourceMaps" value="true" />
Here is the console output on this config run:
workDir: d:\projects\myApp\SDV
deleting: d:\projects\myApp\SDV\com.app.MyApp\compile-1
binding: user.agent=safari
binding: compiler.useSourceMaps=true
binding: locale=en
Compiling module com.app.MyApp
Compiling 1 permutation
Compiling permutation 0...
Source Maps Enabled
Compile of permutations succeeded
Linking into d:\projects\myApp\SDV\com.app.MyApp\compile-1\war\myapp; Writing extras to d:\projects\myApp\SDV\com.app.MyApp\compile-1\extras\myapp
Link succeeded
Compilation succeeded -- 84.458s
Compile completed in 85210 ms
deleting: d:\projects\myApp\SDV\com.app.MyApp\compile-1
[ERROR] unable to create directory: d:\projects\myApp\SDV\com.app.MyApp\compile-1
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.codeserver.CompileDir.mkdir(CompileDir.java:103)
at com.google.gwt.dev.codeserver.CompileDir.create(CompileDir.java:93)
at com.google.gwt.dev.codeserver.Recompiler.makeCompileDir(Recompiler.java:267)
at com.google.gwt.dev.codeserver.Recompiler.compile(Recompiler.java:82)
....
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Process finished with exit code 1
I suspect it maybe Win8 file access permissions problem: cannot create the directory because it wasn't deleted successfully. Both lines in the log above that have this text:
deleting: d:\projects\myApp\SDV\com.app.MyApp\compile-1
are of red color in IDEA (if that has any special meaning).
I unchecked READ_ONLY checkbox in the properties of for the work folder in file explorer, and also run idea64.exe as Admin. Should I somehow run this codeserver compiler "as admin" too? Is it possible?
Also it may be a configuration issue, if it is and somebody can see it from the details below - I would really appreciate the help. Thanks in advance!
UPDATE
Running the superDevMode config with parameter "-noprecompile" gives the same results:
workDir: d:\projects\myApp\sdv
deleting: d:\projects\myApp\sdv\com.app.MyApp\compile-1
Module setup completed in 865 ms
deleting: d:\projects\myApp\sdv\com.app.MyApp\compile-1
[ERROR] unable to create directory: d:\projects\myApp\sdv\com.app.MyApp\compile-1
com.google.gwt.core.ext.UnableToCompleteException: (see previous log entries)
at com.google.gwt.dev.codeserver.CompileDir.mkdir(CompileDir.java:103)
at com.google.gwt.dev.codeserver.CompileDir.create(CompileDir.java:93)
at com.google.gwt.dev.codeserver.Recompiler.makeCompileDir(Recompiler.java:267)
So, definitely looks like file access problem (delete doesn't do its job?). Javadoc to CompileDir.create() method says: "Creates a new compileDir directory structure. The directory must not already exist, but its parent should exist." Seems that it already exists.
I think your configuration is correct. I am using the same parameters (with another portnumber) on my Mac and it works as expected.
The red color of the text:
deleting: d:\projects\myApp\SDV\com.app.MyApp\compile-1
is normal and indicates no problem.
I am not familiar with Windows 8, but would think, that you don't need to run idea.exe with admin rights. I think, uncheck the read-only checkbox should solve your problems.
Another way should be, that you create your workDir directory with Intellij.
File -> New -> directory
(That's what I did).
Ok, so this is fixed now in GWT 2.7.0 by GWT team.
https://code.google.com/p/google-web-toolkit/issues/detail?id=8619
Runs well, even though I can notice the message in the IDE console:
[WARN] unable to delete 'C:\Users\me\AppData\Local\Temp\gwt-codeserver-1341369077945982663.tmp\com.bla.MyAPP\compile-1' (skipped)
[ERROR] unable to create directory: C:\Users\me\AppData\Local\Temp\gwt-codeserver-1341369077945982663.tmp\com.bla.MyAPP\compile-1
Loading Java files in com.bla.MyAPP.
after printing this the IDE continues to run the app server.
Resolving the issue.
I also found that if you are converting your project from GWT 2.6.0 to 2.7.0, you should delete your 2.6.0 run configuration and setup a new one with GWT 2.7.0 defaults.
I am using Karaf 2.3.1. I was following Apache Karaf Manual exercise "Extending the console" page no. 105. I followed all the instruction ditto, with a few deviations. I am able to load the bundle HelloShellCommand into Karaf. It threw me a bundle Id. But the command "test.hello" is not working.
karaf#root> osgi:classes is showing org/apache/karaf.shell/samplesHelloShellCommand.class
karaf#root> test.hello is showing command not found
karaf#root> osgi:list is showing Blueprint "Failure" for the given bundle.
I did deviate from the given instruction in "Compiling the JAR" section in following steps:
Let's try to build the jar: I did build the jar from Eclipse. File-Export-Java-Jar File.
Then run "mvn install": This is where I did not understand how Maven will use the .jar file. It is looking for pom.xml. So, I went into root directory and ran "mvn install". It went through successfully.
osgi:install .., also went through successfully. But I suspect Blueprint.xml did not go through.
I need help in:
How to resolve this?
How to know in Karaf what commands are installed with each bundle?
.jar file created in step-1 is different from "mvn install" which uses pom.xml. Is there something I am missing? How to make mvn use the .jar?
And why blueprint.xml did not load?
Thanks in advance
Further, we have this stackoverflow:
2013-07-27 19:44:30,733 | ERROR | rint Extender: 2
| BlueprintContainerImpl
| container.BlueprintContainerImpl 393
| 7 - org.apache.aries.blueprint.core - 1.1.0
| Unable to start blueprint container for bundle null
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:570)[:1.7.0-ea]
at java.util.ArrayList.get(ArrayList.java:348)[:1.7.0-ea]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.readDirectives
(BlueprintContainerImpl.java:211)[7:org.apache.aries.blueprint.core:1.1.0]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun
(BlueprintContainerImpl.java:283)[7:org.apache.aries.blueprint.core:1.1.0]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.run
(BlueprintContainerImpl.java:261)[7:org.apache.aries.blueprint.core:1.1.0]
at java.util.concurrent.Executors$RunnableAdapter.call
(Executors.java:471)[:1.7.0-ea]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0-ea]
at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0-ea]
at org.apache.aries.blueprint.container.ExecutorServiceWrapper.run
(ExecutorServiceWrapper.java:106)[7:org.apache.aries.blueprint.core:1.1.0]
at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run
(DiscardableRunnable.java:48)[7:org.apache.aries.blueprint.core:1.1.0]
at java.util.concurrent.Executors$RunnableAdapter.call
(Executors.java:471)[:1.7.0-ea]
at java.util.concurrent.FutureTask$Sync.innerRun (FutureTask.java:334)[:1.7.0-ea]
at java.util.concurrent.FutureTask.run (FutureTask.java:166)[:1.7.0-ea]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201
(ScheduledThreadPoolExecutor.java:178)[:1.7.0-ea]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run
(ScheduledThreadPoolExecutor.java:292)[:1.7.0-ea]
at java.util.concurrent.ThreadPoolExecutor.runWorker
(ThreadPoolExecutor.java:1110)[:1.7.0-ea]
at java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:603)[:1.7.0-ea]
at java.lang.Thread.run(Thread.java:717)[:1.7.0-ea]
Regarding 1)
Is the bundle started? Did you use osgi:install -s with starting? If not you should start the bundle with start [bundleId]
Regarding 2)
Issue help at command line, it'll list all available commands. Using command -h will give you a overview of the command itself.
Regarding 3)
forget about creating a jar file from eclipse that won't work. Only with the maven pom you'll have a bundle that contains a valid Manifest unless you added this yourself (which I didn't see in your description)
Regarding 4)
Most likely your bundle either isn't started or it doesn't contain a valid manifest which in turn doesn't start the blueprint extender.
Besides that all those questions are usually best asked at the karaf users mailinglist
EDIT:
For finding the reason why a bundle did fail do a bundle:info on the bundle with the given ID
it should also show you why a blueprint failed.
i have created a jar-file (DicoDB.jar) with Eclipse in the folder called 'program-jar'. Inside a subdirectory 'javahelp' are the following jar-files: jhall.jar, hsviewer.jar, jh.jar and dicoDBHelp.jar (this is my jar-file which contents my help-application).
In the top directory 'program-jar' are also the following jars: jgraph.jar, gnujpdf.jar.
This is my MANIFEST.MF: (The file is manually created)
Manifest-Version: 1.0
Main-Class: gui.DicoDB
Class-Path: jgraph.jar
gnujpdf.jar
javahelp/jhall.jar
javahelp/hsviewer.jar
javahelp/jh.jar
javahelp/dicoDBHelp.jar
At the end of the file is an empty line.
Now I execute the DicoDB.jar in my terminal. Everything works fine until I want to open my help-file (dicoDBHelp.jar).
I get the following exception:
java.lang.NoClassDefFoundError: javax/help/JHelp
The JHelp class is contained by jhall.jar.
Now I don't undertand why the program does not find the class.
So i hope somebody can help me.
Just a thought: try to put all jars in the same line as Class-Path: .... separated by spaces.
Hi allI've found XTend (http://xtend-lang.org) and it really sounds great! But, I can't see any standalone command line compiler for this language. It seems only to run under eclipse. I've done some research, and found some people saying, that it has a command line compiler, but I can't find a download link.
Does the compiler exist, standalone, or do you need eclipse to use it?
Regards
It is not documented, but there is indeed a command line compiler in the Xtend code base - the same one used by the Maven plug-in (that is documented in the Xtend homepage).
If Maven plug-in does not work for you, then you could download the standalone jar version directly from the Maven repository at http://build.eclipse.org/common/xtend/maven/org/eclipse/xtend/org.eclipse.xtend.standalone/2.3.1/ (for version 2.3.1), and execute the org.eclipse.xtend.core.compiler.batch.Main class from it.
This class executes the xtend compiler, and usage information can be displayed (also readable from the source file).
You can use the xtend standalone compiler. For my case I copied the following .jar files to a folder named xtendc:
com.google.guava_21.0.0.v20170206-1425.jar
com.google.inject_3.0.0.v201312141243.jar
javax.inject_1.0.0.v20091030.jar
org.antlr.runtime_3.2.0.v201101311130.jar
org.apache.log4j_1.2.15.v201012070815.jar
org.eclipse.emf.common_2.15.0.v20180914-1817.jar
org.eclipse.emf.ecore.xmi_2.15.0.v20180706-1146.jar
org.eclipse.emf.ecore_2.16.0.v20181124-0637.jar
org.eclipse.equinox.common_3.10.200.v20181021-1645.jar
org.eclipse.jdt.core_3.16.0.v20181130-1748.jar
org.eclipse.xtend.core_2.16.0.v20181203-1347.jar
org.eclipse.xtend.lib.macro_2.16.0.v20181203-0507.jar
org.eclipse.xtext.common.types_2.16.0.v20181203-0528.jar
org.eclipse.xtext.util_2.16.0.v20181203-0514.jar
org.eclipse.xtext.xbase.lib_2.16.0.v20181203-0507.jar
org.eclipse.xtext.xbase_2.16.0.v20181203-0528.jar
org.eclipse.xtext_2.16.0.v20181203-0514.jar
org.objectweb.asm_7.0.0.v20181030-2244.jar
And then, in that folder I executed the CLI main class of the batch compiler:
java -cp "*" org.eclipse.xtend.core.compiler.batch.Main -d <path-to-xtend-gen-folder> -useCurrentClassLoader <path-to-src-folder>
CLI usage of main class is documented to be as following:
Usage: Main <options> <source directories>
where possible options include:
-d <directory> Specify where to place generated xtend files
-tp <path> Temp directory to hold generated stubs and classes
-cp <path> Specify where to find user class files
-encoding <encoding> Specify character encoding used by source files
-javaSourceVersion <version> Create Java Source compatible to this version. Can be: 1.5, 1.6, 1.7, 1.8, 9, 10
-noSuppressWarningsAnnotation Don't put #SuppressWarnings() into generated Java Code
-generateGeneratedAnnotation Put #Generated into generated Java Code
-includeDateInGeneratedAnnnotation If -generateGeneratedAnnotation is used, add the current date/time.
-generateAnnotationComment <string> If -generateGeneratedAnnotation is used, add a comment.
-useCurrentClassLoader Use current classloader as parent classloader
-writeTraceFiles Write Trace-Files
so you will need to pass your classpath there.