The ..\robocode.api\target\launch directory is created in Eclipse by a Ant
build script located in ..\robocode.api.externalToolBuilders\build.xml.
So it have nothing to do with Maven directly.
Maven is used for building the distribution files for Robocode. But when it
comes to debugging and developing Robocode from Eclipse, the Eclipse
environment takes over. The 'mvnassembly' command must have run before the
Eclipse workspace works correctly. But after that, Maven is "only" used for
building the distribution files.
I guess the only thing you need to do is the explicitly invoke 'Project' ->
'Clean...' from the menu in Eclipse to force the launch directory to be
rebuild automatically. Perhaps even a 'Refresh' on the 'robocode.api'
project. If that does not work, then delete the
..\robocode.api\target\launch drectory using the 'Navigator' (for file
access). Then the lauch directory should be rebuild.
I hope this helps?
When you find a solution, then tell me what you did. Then I will write this
into the Robocode Developers Guide so that other developers will benefit
this tip.
I'm trying to create a version of Robocode for use in a classroom
environment, but when I attempt to run Robocode form Eclipse to edit the
sources, I get the following error after I press run as Robocode:
'Launching Robocode' has encountered a problem.
Variable references non-existent resource : ${workspace_loc:robocode.api/target/launch}
I've done and redone the steps in the developers guide, but it hasn't
worked for me yet. The error I get in Eclipse is a reoccurring problem for
me. One other user posted on the forum with the same error message and I
made sure to follow the directions in that post (use JDK 6) but still no
luck. The only thing I can think of being the culprit is having set the
Maven environment variables to M3_HOME and M3 rather than M2 and M2_HOME,
which had previously not allowed Maven to run correctly.
Anyways, here are my Maven and Java version printouts:
[INFO][clean:clean {execution: default-clean}] [INFO] Deleting C:\Users\Nate\git\robocode\robocode.content\target [INFO][resources:resources {execution: default-resources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 40 resources [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.c
ontent\src\test\resources [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.c
ontent\src\main\java [INFO][compiler:compile {execution: default-compile}] [INFO] No sources to compile [INFO][resources:testResources {execution: default-testResources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.c
ontent\src\test\resources [INFO][compiler:testCompile {execution: default-testCompile}] [INFO] No sources to compile [INFO][surefire:test {execution: default-test}] [INFO] No tests to run. [INFO][dependency:copy {execution: copy}] [INFO] Configured Artifact: org.eclipse.jdt.core.compiler:ecj:4.4:jar [INFO] Copying ecj-4.4.jar to C:\Users\Nate\git\robocode\
robocode.content\target
\classes\compilers\ecj.jar [INFO][jar:jar {execution: default-jar}] [INFO] Building jar: C:\Users\Nate\git\robocode\robocode.content\target\
robocode
.content-1.9.2.4.jar [INFO][install:install {execution: default-install}] [INFO] Installing C:\Users\Nate\git\robocode\robocode.content\target\
robocode.co
ntent-1.9.2.4.jar to C:\Users\Nate.m2\repository\
net\sf\robocode\robocode.conte
nt\1.9.2.4\robocode.content-1.9.2.4.jar [INFO][ant:ant {execution: default-cli}] [INFO] Wrote Ant project for robocode.content to
C:\Users\Nate\git\robocode\robo
code.content [INFO] ------------------------------------------------------------
[INFO] Building Robocode Distribution [INFO] task-segment: [clean, install, ant:ant] [INFO] ------------------------------------------------------------
[INFO][clean:clean {execution: default-clean}] [INFO] Deleting C:\Users\Nate\git\robocode\robocode.distribution\target [INFO][resources:resources {execution: default-resources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.d
istribution\src\main\resources [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.d
istribution\src\test\resources [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.d
istribution\src\main\java [INFO][compiler:compile {execution: default-compile}] [INFO] No sources to compile [INFO][resources:testResources {execution: default-testResources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.d
istribution\src\test\resources [INFO][compiler:testCompile {execution: default-testCompile}] [INFO] No sources to compile [INFO][surefire:test {execution: default-test}] [INFO] No tests to run. [INFO][jar:jar {execution: default-jar}] [WARNING] JAR will be empty - no content was marked for inclusion! [INFO] Building jar: C:\Users\Nate\git\robocode\
robocode.distribution\target\rob
ocode.distribution-1.9.2.4.jar [INFO][assembly:single {execution: make-assembly}] [INFO] Reading assembly descriptor: setup.asm.xml [INFO] Reading assembly descriptor: src.asm.xml [INFO] Copying files to C:\Users\Nate\git\robocode\robocode.distribution\target\
robocode-1.9.2.4-setup [WARNING] Assembly file: C:\Users\Nate\git\robocode\
robocode.distribution\target
\robocode-1.9.2.4-setup is not a regular file (it may be a directory). It
cannot
be attached to the project build for installation or deployment. [INFO] Building jar: C:\Users\Nate\git\robocode\
robocode.distribution\target\rob
ocode-1.9.2.4-setup.jar [INFO] Copying files to C:\Users\Nate\git\robocode\robocode.distribution\target\
robocode-1.9.2.4-src [WARNING] Assembly file: C:\Users\Nate\git\robocode\
robocode.distribution\target
\robocode-1.9.2.4-src is not a regular file (it may be a directory). It
cannot b
e attached to the project build for installation or deployment. [INFO] Building zip: C:\Users\Nate\git\robocode\
robocode.distribution\target\rob
ocode-1.9.2.4-src.zip [INFO][install:install {execution: default-install}] [INFO] Installing C:\Users\Nate\git\robocode\robocode.distribution\target\
roboco
de.distribution-1.9.2.4.jar to C:\Users\Nate.m2\repository\
net\sf\robocode\robo
code.distribution\1.9.2.4\robocode.distribution-1.9.2.4.jar [INFO] Installing C:\Users\Nate\git\robocode\robocode.distribution\target\
roboco
de-1.9.2.4-setup.jar to C:\Users\Nate.m2\repository\
net\sf\robocode\robocode.di
stribution\1.9.2.4\robocode.distribution-1.9.2.4-setup.jar [INFO] Installing C:\Users\Nate\git\robocode\robocode.distribution\target\
roboco
de-1.9.2.4-src.zip to C:\Users\Nate.m2\repository\
net\sf\robocode\robocode.dist
ribution\1.9.2.4\robocode.distribution-1.9.2.4-src.zip [INFO][ant:ant {execution: default-cli}] [INFO] Wrote Ant project for robocode.distribution to
C:\Users\Nate\git\robocode
\robocode.distribution [INFO] [INFO] [INFO] ------------------------------------------------------------
[INFO] Building jar: C:\Users\Nate\git\robocode\robocode.tests\target\
robocode.t
ests-1.9.2.4.jar [INFO][install:install {execution: default-install}] [INFO] Installing C:\Users\Nate\git\robocode\robocode.tests\target\
robocode.test
s-1.9.2.4.jar to C:\Users\Nate.m2\repository\net\sf\robocode\robocode.
tests\1.9
.2.4\robocode.tests-1.9.2.4.jar [INFO] ------------------------------------------------------------
[INFO] Building Robocode Installer [INFO] task-segment: [clean, install] [INFO] ------------------------------------------------------------
[INFO][clean:clean {execution: default-clean}] [INFO] Deleting C:\Users\Nate\git\robocode\robocode.installer\target [INFO][resources:resources {execution: default-resources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.i
nstaller\src\main\resources [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.i
nstaller\src\test\resources [INFO] Copying 0 resource [INFO][compiler:compile {execution: default-compile}] [INFO] Compiling 1 source file to C:\Users\Nate\git\robocode\robocode.installer\
target\classes [INFO][resources:testResources {execution: default-testResources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.i
nstaller\src\test\resources [INFO][compiler:testCompile {execution: default-testCompile}] [INFO] No sources to compile [INFO][surefire:test {execution: default-test}] [INFO] No tests to run. [INFO][jar:jar {execution: default-jar}] [INFO] Building jar: C:\Users\Nate\git\robocode\robocode.installer\target\
roboco
de.installer-1.9.2.4.jar [INFO][install:install {execution: default-install}] [INFO] Installing C:\Users\Nate\git\robocode\robocode.installer\target\
robocode.
installer-1.9.2.4.jar to C:\Users\Nate.m2\repository\
net\sf\robocode\robocode.i
nstaller\1.9.2.4\robocode.installer-1.9.2.4.jar [INFO] ------------------------------------------------------------
[INFO] Building Robocode Content [INFO] task-segment: [clean, install] [INFO] ------------------------------------------------------------
[INFO][clean:clean {execution: default-clean}] [INFO] Deleting C:\Users\Nate\git\robocode\robocode.content\target [INFO][resources:resources {execution: default-resources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 40 resources [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.c
ontent\src\test\resources [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.c
ontent\src\main\java [INFO][compiler:compile {execution: default-compile}] [INFO] No sources to compile [INFO][resources:testResources {execution: default-testResources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.c
ontent\src\test\resources [INFO][compiler:testCompile {execution: default-testCompile}] [INFO] No sources to compile [INFO][surefire:test {execution: default-test}] [INFO] No tests to run. [INFO][dependency:copy {execution: copy}] [INFO] Configured Artifact: org.eclipse.jdt.core.compiler:ecj:4.4:jar [INFO] Copying ecj-4.4.jar to C:\Users\Nate\git\robocode\
robocode.content\target
\classes\compilers\ecj.jar [INFO][jar:jar {execution: default-jar}] [INFO] Building jar: C:\Users\Nate\git\robocode\robocode.content\target\
robocode
.content-1.9.2.4.jar [INFO][install:install {execution: default-install}] [INFO] Installing C:\Users\Nate\git\robocode\robocode.content\target\
robocode.co
ntent-1.9.2.4.jar to C:\Users\Nate.m2\repository\
net\sf\robocode\robocode.conte
nt\1.9.2.4\robocode.content-1.9.2.4.jar [INFO] ------------------------------------------------------------
[INFO] Building Robocode Distribution [INFO] task-segment: [clean, install] [INFO] ------------------------------------------------------------
[INFO][clean:clean {execution: default-clean}] [INFO] Deleting C:\Users\Nate\git\robocode\robocode.distribution\target [INFO][resources:resources {execution: default-resources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.d
istribution\src\main\resources [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.d
istribution\src\test\resources [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.d
istribution\src\main\java [INFO][compiler:compile {execution: default-compile}] [INFO] No sources to compile [INFO][resources:testResources {execution: default-testResources}] [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\Users\Nate\git\robocode\
robocode.d
istribution\src\test\resources [INFO][compiler:testCompile {execution: default-testCompile}] [INFO] No sources to compile [INFO][surefire:test {execution: default-test}] [INFO] No tests to run. [INFO][jar:jar {execution: default-jar}] [WARNING] JAR will be empty - no content was marked for inclusion! [INFO] Building jar: C:\Users\Nate\git\robocode\
robocode.distribution\target\rob
ocode.distribution-1.9.2.4.jar [INFO][assembly:single {execution: make-assembly}] [INFO] Reading assembly descriptor: setup.asm.xml [INFO] Reading assembly descriptor: src.asm.xml [INFO] Copying files to C:\Users\Nate\git\robocode\robocode.distribution\target\
robocode-1.9.2.4-setup [WARNING] Assembly file: C:\Users\Nate\git\robocode\
robocode.distribution\target
\robocode-1.9.2.4-setup is not a regular file (it may be a directory). It
cannot
be attached to the project build for installation or deployment. [INFO] Building jar: C:\Users\Nate\git\robocode\
robocode.distribution\target\rob
ocode-1.9.2.4-setup.jar [INFO] Copying files to C:\Users\Nate\git\robocode\robocode.distribution\target\
robocode-1.9.2.4-src [WARNING] Assembly file: C:\Users\Nate\git\robocode\
robocode.distribution\target
\robocode-1.9.2.4-src is not a regular file (it may be a directory). It
cannot b
e attached to the project build for installation or deployment. [INFO] Building zip: C:\Users\Nate\git\robocode\
robocode.distribution\target\rob
ocode-1.9.2.4-src.zip [INFO][install:install {execution: default-install}] [INFO] Installing C:\Users\Nate\git\robocode\robocode.distribution\target\
roboco
de.distribution-1.9.2.4.jar to C:\Users\Nate.m2\repository\
net\sf\robocode\robo
code.distribution\1.9.2.4\robocode.distribution-1.9.2.4.jar [INFO] Installing C:\Users\Nate\git\robocode\robocode.distribution\target\
roboco
de-1.9.2.4-setup.jar to C:\Users\Nate.m2\repository\
net\sf\robocode\robocode.di
stribution\1.9.2.4\robocode.distribution-1.9.2.4-setup.jar [INFO] Installing C:\Users\Nate\git\robocode\robocode.distribution\target\
roboco
de-1.9.2.4-src.zip to C:\Users\Nate.m2\repository\
net\sf\robocode\robocode.dist
ribution\1.9.2.4\robocode.distribution-1.9.2.4-src.zip [INFO] [INFO] [INFO] ------------------------------------------------------------
It's true that there is nothing in that location. The only folders in C:\Users\Nate\robocode-workspace are .metadata, RemoteSystemsTempFiles, and robocode.api. C:\Users\Nate\robocode-workspace\ is my Robocode workspace for Eclipse but the Robocode files pulled from git are located in C:\Users\Nate\git\robocode. This was done automatically by Eclipse. I tried to re-import the files directly into the workspace directory, but Eclipse would not allow me.
After deleting the aforementioned directories, I created a new Eclipse workspace in C:\Users\Nate\git\robocode and imported the Robocode sources to C:\Users\Nate\git\robocoder. Following the source of the error, I changed the linked build.xml, replacing each instance of ${basedir} with C:/Users/Nate/git/robocoder and each instance of ${launch-dir} with C:/Users/Nate/git/robocoder/robocode.api/target/launch. I know next to nothing about xml, but this seemed to work, and the program is now able to build and run! However, when I try to clean all the projects, it again throws the same error, no doubt due to my much less than comprehensive fix.
In short, it seems as if the build directory and launch directory is different from what build.xml expects, as my workspace directory is separate from the build directory. The build.xml uses the location of the workspace instead of the location of the source files. As it stands now, I am able to run the sources but not clean the entire workspace.
Thanks again for replying to my post and explaining the function of Maven. I'm a novice now but in the next few years I plan on learning a great deal and eventually becoming a developer.
Also, EGit now comes built into Eclipse, so there's no longer a need for it to be mentioned on the Developer's Guide.
Much thanks,
Nate
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You are right that all sources should go into your Eclipse workspace - not the separate git\robocode directory.
If EGit (built-in Eclipse) won't check out the sources into your work directory, you could install TortoiseGit, clone all sources into your workspace (perhaps a new one?) and then import all (Robocode) projects as 'existing projects' in your workspace.
You could also edit the 'build.xml' file under ..\robocode.api.externalToolBuilders where you change this line:
Otherwise you'll need to solve the issue with importing the Robocode projects into your workspace. :-)
I definitely need to update the Developers Guide in the near future. I don't have the time for it here and now, but perhaps in a couple of days or weeks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Nate,
The ..\robocode.api\target\launch directory is created in Eclipse by a Ant
build script located in ..\robocode.api.externalToolBuilders\build.xml.
So it have nothing to do with Maven directly.
Maven is used for building the distribution files for Robocode. But when it
comes to debugging and developing Robocode from Eclipse, the Eclipse
environment takes over. The 'mvnassembly' command must have run before the
Eclipse workspace works correctly. But after that, Maven is "only" used for
building the distribution files.
I guess the only thing you need to do is the explicitly invoke 'Project' ->
'Clean...' from the menu in Eclipse to force the launch directory to be
rebuild automatically. Perhaps even a 'Refresh' on the 'robocode.api'
project. If that does not work, then delete the
..\robocode.api\target\launch drectory using the 'Navigator' (for file
access). Then the lauch directory should be rebuild.
I hope this helps?
When you find a solution, then tell me what you did. Then I will write this
into the Robocode Developers Guide so that other developers will benefit
this tip.
Cheers,
Thu Feb 19 2015 at 10.55.11 skrev Nate Schickler zeladada@users.sf.net:
OS: Win 7
Hi,
Thank you for the reply!
When I invoke 'clean...' from Eclipse, I get this error:
It's true that there is nothing in that location. The only folders in C:\Users\Nate\robocode-workspace are .metadata, RemoteSystemsTempFiles, and robocode.api. C:\Users\Nate\robocode-workspace\ is my Robocode workspace for Eclipse but the Robocode files pulled from git are located in C:\Users\Nate\git\robocode. This was done automatically by Eclipse. I tried to re-import the files directly into the workspace directory, but Eclipse would not allow me.
After deleting the aforementioned directories, I created a new Eclipse workspace in C:\Users\Nate\git\robocode and imported the Robocode sources to C:\Users\Nate\git\robocoder. Following the source of the error, I changed the linked build.xml, replacing each instance of ${basedir} with C:/Users/Nate/git/robocoder and each instance of ${launch-dir} with C:/Users/Nate/git/robocoder/robocode.api/target/launch. I know next to nothing about xml, but this seemed to work, and the program is now able to build and run! However, when I try to clean all the projects, it again throws the same error, no doubt due to my much less than comprehensive fix.
In short, it seems as if the build directory and launch directory is different from what build.xml expects, as my workspace directory is separate from the build directory. The build.xml uses the location of the workspace instead of the location of the source files. As it stands now, I am able to run the sources but not clean the entire workspace.
Thanks again for replying to my post and explaining the function of Maven. I'm a novice now but in the next few years I plan on learning a great deal and eventually becoming a developer.
Also, EGit now comes built into Eclipse, so there's no longer a need for it to be mentioned on the Developer's Guide.
Much thanks,
Nate
Hi Nate,
You are right that all sources should go into your Eclipse workspace - not the separate git\robocode directory.
If EGit (built-in Eclipse) won't check out the sources into your work directory, you could install TortoiseGit, clone all sources into your workspace (perhaps a new one?) and then import all (Robocode) projects as 'existing projects' in your workspace.
You could also edit the 'build.xml' file under ..\robocode.api.externalToolBuilders where you change this line:
<property name="launch-dir" location="${basedir}/robocode.api/target/launch"></property>
.. and this line:
<jar destfile="${launch-dir}/libs/robocode.jar" basedir="${basedir}/robocode.api/target/classes"></jar>
You could just hack it for your purpose.
Otherwise you'll need to solve the issue with importing the Robocode projects into your workspace. :-)
I definitely need to update the Developers Guide in the near future. I don't have the time for it here and now, but perhaps in a couple of days or weeks.