首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我正在试图为jsdt定位eclipse的jar存储库

我正在试图为jsdt定位eclipse的jar存储库
EN

Stack Overflow用户
提问于 2018-09-16 18:33:23
回答 2查看 153关注 0票数 0

为了在一个项目中工作,我试图找到一个可靠的存储库,在那里可以获得jsdt核心文件。

虽然'org.eclipse.jdt:org.eclipse.jdt.core:3.14.0‘是非常容易找到的,但是对于我的Gradle构建,我的jsdt并没有这样的外观。我需要一些网络工具。

当我下载eclipse时,我可以在里面找到jar,并且能够找到组和工件ids。但不是声明依赖关系的存储库。

我找到了贾比隆和阿尔弗雷科,但它们都是2013年的,我还发现了2007年的另一个名字。但我想找出他们把这些罐子放在哪里才能在现在的版本中做出选择。

这就是我要找的包: Bundle-SymbolicName: org.eclipse.wst.jsdt.core,它的组似乎是org.eclipse.webtools.jsdt.bundles

有什么想法吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-09-17 05:49:52

只有一些Eclipse插件JAR也被用于Eclipse之外的普通(非OSGi)应用程序中,由Eclipse项目自己发布到Maven或Gradle存储库(例如月食JGit)。

在Eclipse中,p2存储库或包含OSGi包JAR的简单文件夹用于所谓的目标平台 来构建和运行a Java OSGi应用程序

您要查找的工件是最新同时发布更新站点中的工件,但不能从Maven或Gradle访问。

请注意,一些Eclipse插件JAR只在OSGi应用程序中工作(例如,当使用包激活器类时)或在基于Eclipse的应用程序中(例如,当使用Eclipse扩展点时)。

票数 1
EN

Stack Overflow用户

发布于 2018-09-17 17:48:25

作为将来的参考,我构建了一个快速脚本来将eclipse排序到一个存储库结构中,这样我们就可以部署它,如果可以的话,并有一个服务器。

代码语言:javascript
复制
import java.io.IOException;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.nio.file.*;
import java.util.*;
import java.util.regex.*;

public final class DirToRepoStructure {

    private static final Pattern jarNamePattern = Pattern.compile( "(.*)_(\\d+\\.\\d+\\.\\d+)\\.v?(\\d+)\\.jar" );

    public static void main( String[] args ) throws IOException {

        Path root = Paths.get( args[ 0 ] );
        int rootNameCount = root.getNameCount( );

        String rootName = root.getFileName( )
                              .toString( );

        Path tempDir = Files.createTempDirectory( Paths.get( "." ), rootName );
        System.out.println( "using temporary directory: " + tempDir );

        Path achievePath = tempDir.getParent( )
                                  .resolve( rootName + ".zip" );
        System.out.println( "Archiving at: " + achievePath );

        DirectoryStream< Path > stream = Files.newDirectoryStream( root, "*.jar" );

        stream.forEach( jar -> {
            String fullName = jar.getFileName( )
                                 .toString( );

            System.out.println( fullName );
            Matcher matcher = jarNamePattern.matcher( fullName );

            if ( matcher.matches( ) ) {

                String jarName = matcher.group( 1 );

                String version = matcher.group( 2 );

                String snap = matcher.group( 3 );

                System.out.println( "reading: " + jarName + ", " + version );

                createJarStructure( tempDir, jar, jarName, version, snap );

            }
            else {
                throw new IllegalArgumentException( "file name does not match regex" );
            }

        } );

        try ( FileSystem zipFs = getZipFs( achievePath ) ) {

            Files.walk( tempDir )
                 .skip( rootNameCount )
                 .forEach( source -> copyIntoZip( zipFs, source, rootNameCount ) );
        }
    }

    private static void copyIntoZip( FileSystem zipFs, Path source, int rootNameCount ) {

        try {
            Path zipRoot = zipFs.getPath( "/" );

            int tempRootNameCount = rootNameCount + 1;
            int sourceNameCount = source.getNameCount( );

            String newPathName = source.subpath( tempRootNameCount, sourceNameCount )
                                       .toString( );

            Path pathInZipFile = zipRoot.resolve( newPathName );
            Files.copy( source, pathInZipFile, StandardCopyOption.REPLACE_EXISTING );
        }
        catch ( IOException e ) {
            throw new RuntimeException( e );
        }
    }

    private static void createJarStructure( Path tempDir, Path jar, String jarName, String version, String snap ) {

        try {

            Path jarRoot = jar.getParent( )
                              .resolve( jarName )
                              .resolve( version + "-SNAPSHOT" );

            Path jarDirectory = Files.createDirectories( tempDir.resolve( jarRoot ) );

            String shortSnap = snap.substring( 0,8 );
            Path jarTarget = jarDirectory.resolve( jarName + "-" + version + "-"+ shortSnap + ".jar" ); Files.copy( jar, jarTarget );

        }
        catch ( IOException e ) {
            throw new RuntimeException( e );
        }
    }

    private static FileSystem getZipFs( Path archivePath ) throws IOException {

        Map< String, String > env = new HashMap<>( );
        env.put( "create", "true" );
        env.put( "encoding", StandardCharsets.UTF_8.toString( ) );

        System.out.println( archivePath );
        URI uri = URI.create( "jar:file:" + archivePath.toAbsolutePath( ) );
        return FileSystems.newFileSystem( uri, env );

    }
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52357234

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档